• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDK problem for beginner  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a couple of opensource apps that run on JDK 1.7 and newer. My OS is Win8.1 64bit. I have JDK 1.8 installed.
I am trying to install another open source app. This app however can only run without error in JDK 1.6.
I know if I install JDK 1.6 on this Win8.1 system, there would not be any problem.
What I want to know is how should I modify the environmental variables JAVA_HOME and PATH so that my existing apps which requires JDK 1.7 and newer can coexist with this new app which requires JDK 1.6?
The current values for these 2 environment variables are:

"JAVA_HOME" the value is "C:\Program Files (x86)\Java\jdk1.8.0_20"
"Path", one of the value is "...;C:\Program Files\Java\jdk1.8.0_11\bin;..."

After I install JDK 1.6, should I simply add the location of the folder and the bin folder where JDK 1.6 is located to the values of the above variables and all the above apps should run OK?
If not, what should I do or modify?

Thanks in advance.

 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, the environment variable JAVA_HOME is not used at all by the JDK or any of the tools in it (for example the Java compiler and application launcher). Some other programs such as Apache Tomcat and Maven use it, but it is not required at all for the JDK tools themselves.

If you want to run a Java program with a specific JVM version, you can just explicitly use the path to the right version. So, on the command line, instead of typing (assuming you have an executable JAR):

java -jar myprogram.jar

You type the full path of the JVM executable you want to use:

"C:\Program Files\Java\jdk1.8.0_11\bin\java.exe" -jar myprogram.jar

If this is too much typing, then you can just put that command in a Windows batch file (for example, call it "myprogram.bat"), then you can just run your program by executing the batch file.
 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think you can write something like
set PATH="c:\Program Files\Java\jdk1.6.0_99\bin";%PATH%
at the command line and set the PATH for the lifetime of the current command prompt window. Only I said something like because I am not sure I have got the right instruction.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!