File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure 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: 169
  • 0
  • 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: 169
  • 0
  • 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: 3908
9
Chrome Fedora Hibernate
  • 0
  • 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
Pie
Posts: 47293
52
  • 0
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic