Select a particular JRE from the command lineTag(s): Environment
It's possible to have many JRE side-by-side on a computer.
If the JRE is properly installed on Windows, informations about each version are stored in the registry. The installation process installs a special java.exe in the system PATH. So you don't need to alter you PATH because this special java.exe will find the current JRE. From a command line, type java -version to display the current jre version installed.
With release 1.6, it's now possible to select a different JRE installation than the last one without any registry modification.
The JRE installation are listed in the registry in the key HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
Take this simple test class
public class ShowVersion { public static void main(String args[]) { System.out.println(System.getProperty("java.version")); } }
> java ShowVersion
To force the 1.5 JRE instead, use this command line.
> java -version:"1.5" ShowVersion
ref : Java 6 technotes
You can always give the complete path to use a specific installation. Launching the JVM this way does not use the registry setting at all.
>"C:\Program Files\Java\j2re1.4.1_02\bin\java" -version java version "1.4.1_02"
Send comment, question or suggestion to howto@rgagnon.com