Two JVMs and setting the environment variable having issues

I am working on two projects one uses JDK 8 and other uses JDK 6. I installed both the jdks in my machine where JDK8 is set as my default JVM. so I am good with one project settings.

When I am working on second project, I tried to change JAVA_HOME to C:\Program Files\Java\jdk1.6.0_45 and PATH added with C:\Program Files\Java\jdk1.6.0_45\bin and surprisingly I am seeing JDK8 as my default JVM. I checked with java -version or java -fullversion.

Questions.

Where should I stop the Java process that is initiated with JDK8 ? Where should I start the Java process for JDK6 ? How should I easily switch JVMs when I switch back and forth working on two projects ?

I dont like the idea of uninstalling one jvm when I have to work with another jvm.

Please suggest me. Thanks for your time.

Narayana.V

Answers


When you run a program in your shell, it is the PATH environment variable which determines which program is run. This is a feature of DOS prompt and unix shells and not specific to Java. If you want to change the program which is run by default, you need to change the PATH.


Need Your Help

Need strategy for implementing single-source of reusable web applications

oop templates web-applications model-view-controller coldfusion

I'm mostly a frontend designer/dev who's inherited some outdated ColdFusion applications and I'm trying to clean them up and make them easier to maintain. Because of my limited exposure to OOP/MVC/...

Jekyll - Error Running 'Jekyll Serve'

ruby gem jekyll

EDIT: Found the answer (see my answer below!). It involves using version 1.4.2 instead of 1.4.3, so if anyone has any ideas on getting 1.4.3 working, that could be helpful as well. Thanks!