Question

Is there a way to run Java 6's Hotspot with Java 5's runtime environment? I have some code that depends on the behavior of older implementations of classes, but I'd like to use a more recent JVM. I do have plans to migrate the code to Java 6 (or maybe 7!), but right now, I'm more concerned with seeing if I have a JVM issue.

Was it helpful?

Solution

I think you are better off with one of the following:

  • Figure out if you can modify your application code to work around the XSLT bug in Java 6.

  • Find out if there is a Sun/Oracle supported patch for the XSLT bug on Java 6.

  • Use a Java 5 JRE.

  • Try the latest Java 6 JRE to see if the XSLT bug is fixed there.

  • Try the latest Java 7 JRE to see if the XSLT bug is fixed there.

The problem with using a Java 5 rt.jar on a Java 6 JVM is that there are hidden dependencies between core classes in the rt.jar and the native code implementation of the JVM; i.e. java binary and associated native libraries. These are not documented, and it is (IMO) highly likely that some of them changed between Java 5 and Java 6.


If there are native incompatibilities between the two, it looks like I'm left with grabbing the specific classes I need and either replacing them in rt.jar or overriding them with extdir.

Hacking Java like that is not a good idea. At a minimum, you'll have to repeat the hackery each time you download and install the latest Java 6 JRE on your application's platform. (And if you are supplying this application to others, then THEY have the problem too.)

And there are still 2 alternatives in my original that you could use instead: fix the application to workaround the problem, and stay with Java 5.


The bug exists in the Java 7's XSLT and in the latest Xalan

Have you considered the possibility that this is not a bug at all? Maybe it is a fix for a previous bug or allowed behavior within the scope of the relevant specs, and your code is at fault for depending on the previous (buggy?) behavior.

Are there bug reports in the Java / Xalan bug databases for this bug? What do the maintainers say? Do they offer workarounds? (These questions NEED to be asked ...)

OTHER TIPS

It is mostly backward compatible, we just migrated some 1.4.x code to 1.6 (with and without recompiling, therefore binary and source) and that worked.

I suggest you to have a look at every major java version release as there are always some incompatibilities. Have a look at the Java 1.6 compatibility with 1.5 and if you are migrating some older versions of source / binary, check all the major java versions page to see if you fall in the incompatibilities.

Edit: in your question, you wrote that you want Hotspot 1.6 (the JVM) to run with JRE 1.5 ? You know the JRE includes the JVM, are you certain about what you just asked ?

I am not sure if I understand your question correctly, but if you compiled your code with a java 5 compiler, then yes, you can run it on a java 6 vm without issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top