View Full Version : Java Version Support?

20 Jan 2012, 2:06 PM
Seems that the GXT jars in Maven are compiled with Java6 compatibility? Possible to have a version for Java5?

Colin Alworth
22 Jan 2012, 9:43 PM
The Ext GWT 3 betas all require at least GWT 2.4.0, and since about 2.3.0, GWT has required Java 6. If you cannot support Java 6, you will be unable to support any GWT version beyond 2.2, where warnings were issued that Java 5 support was going away.

23 Jan 2012, 8:20 AM
The jars in GWT 2.4.0 (gwt-dev, gwt-user, gwt-server) appear to be compiled to work with Java 5. I know I've seen somewhere that they are planning to support only Java 6 in the near future, but I can't find where that is.

Anyways, it seems that we can still use GWT 2.4.0 with Java 5.

Colin Alworth
23 Jan 2012, 8:41 AM
On compiling a GWT 2.4.0 project with JDK5, I get

WARNING: Use on a JRE prior to version 1.6 is deprecated
followed by a compiler error, Arrays.copyOf([II)[I is not found. This method is new in Java 6 (see Arrays.copyOf (http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#copyOf(int[], int))), and so cannot be used from JsFunctionClusterer.exec in the compiler.

It may be that GWT 2.4 is compiled in part or all with JDK5, but it needs Java6 runtime to be used. Or do you know of a way to allow it to work with an earlier version? Given those sorts of fundamental issues, the Ext GWT team decided to take advantage of the language changes in 6, such as @Override annotations on interface declared methods.

23 Jan 2012, 9:49 AM
Colin, thanks for the reply.

Unfortunately, the GWT folks aren't completely open with what version of runtime is required. You'd think this would be something prominent in the release notes. I did find this thread (https://groups.google.com/group/google-web-toolkit/browse_thread/thread/7c04f0d2b2fc9521/35a3fc77e457bcc5?lnk=gst&q=jdk#35a3fc77e457bcc5) on Google Groups which does seem to say that starting with GWT 2.4 JDK 6 is required.

We are also using @Override on interface method in our GWT code, but if I set the Maven source/compiler properties to 1.5 it seems to work (using a Java6 JDK to compile) with GWT 2.4, except I was getting exceptions because of the GXT jar. There were other API changes in Java 6 that could cause problems, at least if the code is meant to run on the server (not compiled to JavaScript).

Anyways, if Java 6 is a requirement, I'm fine with that, just wanted to be sure.

Colin Alworth
23 Jan 2012, 10:01 AM
In the interest of being thorough, can you confirm that when you compile a GWT project from maven with Java 5 that you are actually using a Java5 JDK/JRE, and not a 6 one, targetting a runtime of version 5? If so, and you are not getting the compiler error that I am seeing (i.e. actually using a Java 6 runtime), then there may be a way to properly use Java 5. From that thread though, it seems Jeff Larsen (GWT team member) is saying that gwt-servlet, etc are compiled with Java 5 so they can be used on an older server, but that the compiler requires 6.

If you need a 1.5 version of GXT, we might be able to make that happen, but the only classes in the gxt jar file that are used on the server would be a handful of interfaces and implementations, for use in the loader. Everything else at this time is designed for use on the client only, and so with the compiler, which requires Java 6.

24 Jan 2012, 9:41 AM
If I use a Java5 JDK for the maven compile, I do get the deprecation warning, and the compile fails. I find it interesting that we still get a deprecation warning from the 2.4 compiler, rather than it just saying it doesn't support a JRE prior to 1.6.

I'm not really interested in using an older version of GWT. We're just starting to use GWT, so we are starting with the latest SDK (2.4.0) and GXT (3.0-betas). So, no worries on that front.

We've been doing all our development with Java6 as the deployment platform, but got a request this week to deploy into a container that currently is running Java5 (sigh). So, we were just trying to see if it would even work.

What I actually tried, thinking back, is I left the GWT compiled stuff the same (the JS) - it was generated with Maven and Java6. I was just taking the server-side jars and compiling them to be Java5 compatible and replacing them in my war file. I was able to do that with my jars (we had one usage of a Java6 API that I could change, I was able to leave my interface annotations). The GWT jars appear to be Java5 compatible by looking at them with a version checker. The GXT jar was the sticking point. This was really all just a test to see if it could even work.

So, I don't know if it would even be possible to have a Java5 compatible GXT jar (even as an option). If not, that's ok, it's not a show stopper for me. I just get to say we won't support a Java5 deployment target. :)

Colin Alworth
24 Jan 2012, 9:47 AM
If it becomes a bigger sticking point, but not big enough so you would want to break your project into java6/client and java5/server, consider a support ticket to have a jar made that strips out the java6 pieces - Besides the @Override on interface methods, I think we may have a little bit of generics that will get ugly.

Otherwise, we can remind people that Java5 has been past its EOL period[1] for over two years.

[1] http://java.sun.com/j2se/1.5/