Once installed, the latest JRE/JDK (currently, Java 6) become the JVM of choice for any app in Windows OS and it was quite tricky for me to force an app to be executed under Java 5.
I saw many posts on the Internet claiming they solved the issue by manually
editing Windows registry and/or replacing soem files in Windows/system32 directory - never wanted to do that.
This post is probably the closest to what I wanted to do, however the code from this post did not work 'as is' in my batch files.
Looking at java.exe command options in Java 6 I found an amazing feature:
-version:
This is what the command line java says about it:
-version:
require the specified version to run
Sounds just what I needed! So I run it like this:
>java -version:1.5.0_17 -version
And voila! - here is what says my Java 6 now:
java version "1.5.0_17"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode)
Of course if I run it with just -version (no ":" and no alternative JRE/JDK), it keeps saying:
> java -version
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)
No comments:
Post a Comment