File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to use the JRE I want, to launch my program when I have two JDKS installed? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to use the JRE I want, to launch my program when I have two JDKS installed?" Watch "How to use the JRE I want, to launch my program when I have two JDKS installed?" New topic
Author

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

Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 167
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
Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 167
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

Joined: Mar 24, 2008
Posts: 3859

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.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
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
 
subject: How to use the JRE I want, to launch my program when I have two JDKS installed?