• Share this article:

Eclipse SDK and Java 5

Monday, January 30, 2006 - 21:29 by Wayne Beaton

Every now and then, somebody asks a question about whether or not the Eclipse IDE supports Java 5. If you look at the 3.1.2 release notes, you’ll see that version 3.1.2 has been tested on Java 1.4.2 on variety of platforms (Linux, Windows, Mac OS, AIX, Solaris, HP-UX) as well as Java 5 on Windows XP. Based on this information, one might conclude that Eclipse 3.1.2 only supports Java 1.4.2.

When the release notes talk about the tested platforms, they are referring to the platforms upon which the Eclipse IDE itself runs. That is, the Eclipse IDE is itself a Java program that runs on a Java virtual machine (JVM). The Eclipse IDE, version 3.1.2, including the views, editors, compilers, and what-not are all tested and validated on the Java 1.4.2 JVM (and Java 5 on Windows XP). While the 3.1.2 plan doesn’t specifically discuss running on Java 5, many people are doing just that. In fact, if you take a look on news.eclipse.org/eclipse.platform, you’ll find several messages from folks who have been successfully running an Eclipse 3.1 version (including pre-release versions) on Java 5. It works (I’ve been running 3.1.1 on Java 5 on both Windows and Linux for months). So… while it’s not officially tested in the lab, it is certainly tested in the field.

That aside, the Eclipse SDK 3.1.2 does support the construction of applications using Java 5. You can build, edit, compile, debug, and test Java 5 projects with all the bells and whistles you’ve come to expect from Eclipse (you can, for example use code completion to fill in the type for a generic).

Out of the box, Eclipse 3.1.2 is configured for creating Java 1.4 applications. You can turn on Java 5 support using the preferences window as shown below.


If you set the “Compiler compliance level” to 5.0, it’ll let you use all the wonderful new syntax introduced with Java 5. If you’re not running Eclipse itself on a Java 5 JVM, you’ll have to add one to the “Installed JREs” in order to gain access to the Java 5 libraries and source code (look here for help). You can also specify what version of Java you want to work on a project-by-project basis. You can have some projects in your workspace that use Java 1.4 and some that use Java 5 (and some that use other Java versions).

Eclipse 3.2 is tested against Java 5 on all platforms; it says so right in the plan. Version 3.2 doesn’t officially ship until June (as part of the “Callisto” release train), but you can get it today so long as you don’t mind running into an occasional bug (as should be expected when using a pre-release build). If you do run into a bug, be sure to report it so that development teams can address the issue. I’ve been working with Eclipse 3.2M3 for a few months now and it’s been great.

So… does Eclipse support Java 5? It sure does. In summary:

  • Eclipse 3.1.x is tested and validated on Java 1.4.2
  • Though not officially tested and validated, Eclipse 3.1.x is run on Java 5 by many people who use it every day for development
  • Eclipse 3.2 is tested and validated on Java 5
  • Both Eclipse 3.1.x and 3.2 can be used to build, compile, debug, and test Java 5 applications