Java SE 6 Released
By Dkildahl -Oracle on Jun 01, 2011
The next major release of the Java Platform, Standard Edition, (Java SE 6) is released today. Some of the features in this new major release are documented in the list of key features. Remember to check out the release notes and compatibility notes.
I have been using Java SE 6 as the default Java on my laptop during most of the development this release. It is really stable, I use Linux on my laptop and integration with the GNOME desktop has improved over Java SE 5.0. I have noticed that compiling the compiler is faster and I heard on Friday that we have an overall 10% performance improvement. Caveat: for some reason, the performance of
Thread.sleep(long) remains unchanged
In the compiler area, we have focused our performance efforts exclusively on memory use. The idea is that the less time is spent on garbage collection, the faster compilation. Hopefully this should translate into benefits for IDEs building on
javac (as NetBeans does): faster response times and ability to handle larger projects.
The biggest feature of the compiler is that there are no new language features. Hopefully, this should allow you to upgrade to JDK 6 without any problems whatsoever. There are changes to the compiler's default, so make sure that you set
-target options explicitly. If you get encoding warnings on
-source 5 you will get an error with
-source 6. Besides a ton of bug-fixes (some of which may result in the compiler rejecting programs incorrectly accepted by older versions, albeit rarely), the language is unchanged. All in all, I recommend that you start using
javac from JDK 6 to build your applications today. We have focused on compatibility in Java SE 6 but if you do not feel ready to deploy Java SE 6 throughout your organization, you should still switch to JDK 6 for your development: you get a better and faster compiler.
You may wonder:
did you spend all your time on performance and bug-fixes? Well, no. If you have been following my blog, you already know that we have added a whole suite of new APIs that makes it easy to run a Java compiler from a program. The new Java Compiler API allows you to invoke a compiler, gives access to diagnostics, and control over how files are read through a file manager. The file manager allows applications such as IDEs and JSP servers to keep all files in memory which significantly speeds up compilation. Sun's open source Java EE implementation, GlassFish, has already benefited from this.
We also standardized annotation processing API and included annotation processor support directly in
javac. The new API should be familiar to users of the proprietary tool
apt. Switching to
javac-based annotation processing requires some work but annotation processing becomes much faster. Annotation processing includes a Java model for analyzing program structures. This API can be used outside annotation processing and is complemented by a proprietary (yet open source) API for access to abstract syntax trees. A complete list of the API can be found in the
We are currently writing user guides for all this new API. The draft is available from OpenJDK. We also have some draft examples including a tool that generates XML output of source files with errors. I recommend that you view these files in Firefox.