Windows – how to use two different versions of java in the same computer

javawindowswindows 7

we have one java application which can work only on 1.6 and a website which works only on the latest java 1.7.

We have both java installed on our computer. But unfortunately, it cannot detect automatically which java to use while running applications.

It seems by default computer use 1.7 so when I use the application, I have to go to control panel and disable 1.7 so that computer can use 1.6.

Is there any solution to it? Like computer understands automatically 1.6 for the application and 1.7 for loading on browser.

Best Answer

The problem is that the Java version to use is configured up in a system variable JAVA_HOME and/or by adding the relevant java.exe to the bin path and the whole system looks at those two locations.

To run using a different java version you just have to run that version.

So configure whichever version you want in your web browser as your main one.

Then create a link/batch/whatever to run the program and directly select the java you want to run. i.e.:

/java6/bin/java.exe MyApp.jar
Related Question