Couple of folks have asked us the reason GlassFish requires JDK 5 on Ubuntu - inspite of the fact that we bundle JDK 6 in Ubuntu. In this short blog, I will answer this question and list the steps to run GlassFish with JDK 6.
GlassFish is used to build the Java EE Reference Implementation. Java EE moves lockstep with JDK versions, for e.g: Java EE 5 with JDK 5, J2EE 1.4 with JDK 1.4 and so on. This was one of the biggest reason for us to require JDK 5. Having said that, the GlassFish works with JDK 6 as well.
Another reason, was that JDK 6 and GlassFish integrations were happening in parallel. Leaving us little time to effectively test with JDK 6. GlassFish with JDK 5 has gone through the entire SQE tests (about 15000 tests) and the Java EE Compatibility tests (some 17000 of those) - we just did not have the cycles to do that level of testing for JDK 6 before the release on Ubuntu.
Steps to run GlassFish on JDK 6
The easiest way to change from JDK 5 to JDK 6 is to go to /usr/share/sunappserver/config/asenv.conf and change the AS_JAVA variable to point to JDK 6. This will change the JDK for all domains installed - which is the right way to do it IMO.
Another way to do this, is to run the following command:
sudo /usr/share/sunappserver/bin/asadmin set "server-config.java-config.java-home=path-to-jdk-6".
This changes the JDK per domain basis.
Upgrading from JDK 5 to JDK 6 should work seamlessly. There is a caveat while moving back from JDK 6 to JDK 5. If any code is generated with JDK 6 - you may run into compilation issues with JDK 5.