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

64,246

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
Share:
64,246

Related videos on Youtube

user1449596
Author by

user1449596

Updated on September 18, 2022

Comments

  • user1449596
    user1449596 about 1 year

    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.

    • Ramhound
      Ramhound almost 10 years
      I was able to find this question over at Stackoverflow. Looks like you will have to configure the path variables and likely require the source to both the application and the website. stackoverflow.com/questions/271609/…
    • avirk
      avirk almost 10 years
    • avirk
      avirk almost 10 years
      @Ramhound may be buddy, I'm not sure as I don't have any reason to check it atm on my pc. :)
    • Ramhound
      Ramhound almost 10 years
      @avirk - If you have not even confirmed it still works with the current version of Java how can you suggest it?
    • avirk
      avirk almost 10 years
      @Ramhound he can try nothing will be harm him, its not necessary that we can't suggest what we have not tried or it is?
    • Ramhound
      Ramhound almost 10 years
      @avirk - I suppose thats what comments are for, I just don't think its all that responsible, to suggest a solution that you have not personally tried.
    • barlop
      barlop almost 10 years
      @avirk it is reasonable and fine to suggest something you haven't tried but you should write "I haven't tried this But here-".
  • user1449596
    user1449596 almost 10 years
    the application is just a client running through java webstart so there is no environmental variable called java_home ..I'm not sure how to create a batch file
  • Tim B
    Tim B almost 10 years
    Running through web start I don't think you can, you have to run in whatever version of Java they have installed.