I have to install a lower version of Java on some clients but some of them have a new version already installed. Do you know which one will take precedence? Is there a way to force Java to use a certain version without uninstalling the other? We have an application that requires the certain lower version.
Asked
Active
Viewed 489 times
1
-
https://stackoverflow.com/questions/271609/multiple-java-versions-running-concurrently-under-windows – Shashank Shekhar Jun 17 '15 at 19:24
-
2Which operating system? – RealSkeptic Jun 17 '15 at 19:25
-
Whichever is defined first. – Dennis Jun 17 '15 at 19:25
-
1It should be noted that newer versions of Java can run the older versions' code just fine, as well as compile to an older spec of Java too. – Makoto Jun 17 '15 at 19:26
-
How do I define which is first? – user1342164 Jun 17 '15 at 19:26
-
Why do you want to run or select older version when the newer version can run the old code just fine. – mustangDC Jun 17 '15 at 20:19
3 Answers
6
By client I suppose you mean some Windows machine?
You can control which version is used by setting:
- The system path to include the java.exe you want used at runtime.
- The JAVA_HOME variable to point to the JDK library, only if development takes place on the machine.

amahfouz
- 2,328
- 2
- 16
- 21
-
For clients, ok so you mean setting the system path in the application? – user1342164 Jun 17 '15 at 19:27
-
1
2
If the client you are using does NOT have the option to setup JDK, then it will look into what ever JAVA_HOME you have defined in your OS environment variable.
There are clients, such as Eclipse, where you can define any version of JDK installed on your machine.

Armaiti
- 766
- 3
- 11
1
Also, if you are just launching your app using Java (and the app itself is not invoking any Java), you may be able to get away with just setting the shortcut that launches the app:
...\my\path\to\java\java.exe NameOfAppMainClassInYourJar.class
and setting the classpath as indicated here.

amahfouz
- 2,328
- 2
- 16
- 21