Newbies should install only one JDK (Java Development Kit) or JRE (Java Runtime Environment) at a time. You can have several installed, but unless you have very good reason to, don’t because you will trip over yourself. For most people, you are best off to uninstall your old JDKs (Java Development Kits) and JREs (Java Runtime Environments) before installing new ones. Then there is no possibility of using a different JRE/JDK from the one you intended.
If you want to install multiple JDK s, first uninstall all your JDKs and JRE s, 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.8.0_112\ \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.8.0_112\ to point to the JDK you want to use. Also put J:\Program Files\java\jdk1.8.0_112\ 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.
This page is posted
Optional Replicator mirror
Your face IP:[184.108.40.206]
You are visitor number|