Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use the JRE I want, to launch my program when I have two JDKS installed?

 
Varuna Seneviratna
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have JDK 6 and JDK 5 installed.I can use the preferred compiler by setting the path at the time of compiling But How do I use the preferred JRE to run a program using the "java" command?

 
Varuna Seneviratna
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Matter resolved, By setting the path it is possible to invoke the preferred JRE and the Compiler both.But if the path is not set at the time of compiling, the JRE that is invoked by typing "java" at the command prompt is the JRE that was installed with the first JDK installed.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But if the path is not set at the time of compiling, the JRE that is invoked by typing "java" at the command prompt is the JRE that was installed with the first JDK installed

How do you define the "first JDK installation" here? In general it's the first to appear in the path is picked. And you can check the version used by java by typing java -version. For this, of course you should have set the path appropriately or be in the JDK/bin directory or use the exact path to the JDK/bin.
 
Campbell Ritchie
Sheriff
Posts: 48431
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe better to write the full path when you invoke "java" . . . or similar. Saves problems later when you have forgotten what you changed the system PATH to. You may need "" if there is a space in the PATH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic