wood burning stoves 2.0
The moose likes Java in General and the fly likes multiple JREs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "multiple JREs" Watch "multiple JREs" New topic

multiple JREs

Graham Mead
Ranch Hand

Joined: Sep 28, 2001
Posts: 57
I currently have a machine which has JRE 1.3.0 running on it (using the PATH variable) but need to run an application at the same time which requires JRE 1.4. I don't want the original app to be affected or use 1.4.
What is the most elegant way to run up the second app so that it uses 1.4 but doesn't affect anything else.
TIA Graham
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Set up a bat file (or .sh file for unix) and set the path and classpath on the fly to point at the 1.4 JRE.
Something like myapp.bat
PATH c:\jdk1.4\bin;c:\jdk1.4\MyApp;%PATH%;
java -cp .;c:\jdk1.4\MyApp;c:\jdk1.4\jre\lib\rt.jar;c:\jdk1.4\jre\lib\jaws.jar;c:\jdk1.4\jre\lib\i18n.jar;c:\jdk1.4\lib; myapp

"JavaRanch, where the deer and the Certified play" - David O'Meara
Hari Gangadharan
Ranch Hand

Joined: Mar 08, 2001
Posts: 73
This may work out well in most platforms including Windows. I do the same thing. However, sometimes the Java versions may compain about the registry value:
HKEY_LOCAL_MACHINE/Software/Javasoft/Java Runtime Environment/CurrentVersion
I don't remember the exact error message (Something like registry value CurrentVersion found to be 1.3 expected 1.4), but many times I regedit and change this from 1.3 to 1.4 and back. I encountered this while using Windows NT.
[ February 03, 2003: Message edited by: Hari Gangadharan ]

<B>Hari Gangadharan</B><BR>Unix is user friendly..<BR>but it chooses to whom it is friendly with!
Graham Mead
Ranch Hand

Joined: Sep 28, 2001
Posts: 57
Cheers Cindy, thanks for the reply
I agree. Here's the link: http://aspose.com/file-tools
subject: multiple JREs
It's not a secret anymore!