If you want to install multiple JDKs, first uninstall all your JDKs and JREs, in order, uninstalling most recent to oldest. Manually delete all the Java directories, and delete all copies of java.exe, javac.exe, javaws.exe etc. you find anywhere on your machine including in C:\Windows\System32. For extra safety delete all the Java registry entries too. Then install the JREs and JDKs the oldest version first and install them in order. If you want the JDK, there in no need to install the corresponding JRE as well. You will get two JREs bundled with the JDK automatically.
Why go to all this work? Sun tests the installs and uninstalls in the order they release the JDKs/JREs. It would be a huge amount of work to test every permutation of orders in install/uninstall of the JDK versions. Further, if a problem were detected, they could not very well modify an old version to correct the problem because many people already have the defective version installed. Old versions have no knowledge of newer versions. To prevent them from inadvertently meddling with newer versions, they should never be installed/uninstalled in the presence of newer version. On the other hand newer versions are aware of the quirks of older versions, so can be safely installed in their presence, especially the version immediately one prior, the most common case.
Then instead of saying java.exe, use the fully qualified name to select which version of the java run time you want e.g. J:\Program Files\java\jdk1.6.0_17\bin\javac.exe. You an use the Java control panel to select which JRE to use in Java Web Start and in Applets, but not from the command line. Also change set JAVA_HOME J:\Program Files\java\jdk1.6.0_17 to point to the JDK you want to use. Also put J:\Program Files\java\jdk1.6.0_17 on the path.
JAVA_HOME helps Java auxiliary programs like ANT find the JDK. The path lets Windows find the JDK executables you want to use such as javac.exe.
You can also use -source, -target and -bootclasspath to compile with a recent compiler version to approximate what you would have produced with an earlier version.
| You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | |
| http://mindprod.com/jgloss/multiplejdks.html | J:\mindprod\jgloss\multiplejdks.html | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.191.103] | |
| Feedback | You are visitor number 11. | |