Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Switching java runtimes (Windows, Ant, Java control panel)

Reply
Thread Tools

Switching java runtimes (Windows, Ant, Java control panel)

 
 
Karsten Wutzke
Guest
Posts: n/a
 
      05-18-2007
Hello all!

I've been searching for quite some time, but I can't seem to find a
solution...

How do I best switch Java runtimes on a machine where I have JDK 5.0
an 6.0 installed?

My app is made for 5.0 only, but the currently used JRE is always 6.0.
The java.exe in the windows system dir seems to point to the latest
version at all times.

I launch my app from the shell via "ant run" so it is a must that Ant
has to find the "current" JVM. Using absolute paths is not an option
since I use Ant (and will stick to it no matter what).

How do I best switch between JRE's?

Is it possible to switch JRE's without creating a new shell window?

Things that didn't work so far:
- Setting the default JRE via the Java control panel (I haven't found
that anywhere in the dialog...)
- Replacing the PATH entry to the java home dir of 1.5.x
- Setting JAVA_HOME=C:\dev\jdk1.5.0_11\bin
- Adding the jvmversion="1.5" param to Ant's <java> task

I don't want to do any brute-force stuff here.

Maybe someone knows an article that I haven't found so far. Otherwise
I'm all ears...

Karsten

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      05-18-2007
Karsten Wutzke wrote:
> - Replacing the PATH entry to the java home dir of 1.5.x
> - Setting JAVA_HOME=C:\dev\jdk1.5.0_11\bin


JAVA_HOME would normally be set to the parent directory of bin/.

set JAVA_HOME=C:\dev\jdk1.5.0_11
PATH=%JAVA_HOME%\bin;%PATH%

If you're starting a program or batch file graphically (double-click) then you
will need to set these envars in the Control Panel System utility.

How exactly are you invoking java?

--
Lew
 
Reply With Quote
 
 
 
 
printdude1968@gmail.com
Guest
Posts: n/a
 
      05-19-2007
On May 18, 6:46 pm, Lew <(E-Mail Removed)> wrote:
> Karsten Wutzke wrote:
> > - Replacing the PATH entry to the java home dir of 1.5.x
> > - Setting JAVA_HOME=C:\dev\jdk1.5.0_11\bin

>
> JAVA_HOME would normally be set to the parent directory of bin/.
>
> set JAVA_HOME=C:\dev\jdk1.5.0_11
> PATH=%JAVA_HOME%\bin;%PATH%
>
> If you're starting a program or batch file graphically (double-click) then you
> will need to set these envars in the Control Panel System utility.
>
> How exactly are you invoking java?
>
> --
> Lew


He could create a batch file that will switch between them. All he
would have to do is something like (this would be easier on Linux)
if %JAVA_HOME%="C:\dev\jdk1.5.0_11"
then
set JAVA_HOME=other jdk location
endif
PATH=%JAVA_HOME%\bin;%PATH%

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      05-19-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> He could create a batch file that will switch between them. All he
> would have to do is something like (this would be easier on Linux)
> if %JAVA_HOME%="C:\dev\jdk1.5.0_11"
> then
> set JAVA_HOME=other jdk location
> endif
> PATH=%JAVA_HOME%\bin;%PATH%


They would need to remove the old, now-invalid PATH element also.

--
Lew
 
Reply With Quote
 
Karsten Wutzke
Guest
Posts: n/a
 
      05-21-2007
On 19 Mai, 00:46, Lew <(E-Mail Removed)> wrote:
> Karsten Wutzke wrote:
> > - Replacing the PATH entry to the java home dir of 1.5.x
> > - Setting JAVA_HOME=C:\dev\jdk1.5.0_11\bin

>
> JAVA_HOME would normally be set to the parent directory of bin/.
>


Oops I had that already...

> set JAVA_HOME=C:\dev\jdk1.5.0_11
> PATH=%JAVA_HOME%\bin;%PATH%
>
> If you're starting a program or batch file graphically (double-click) then you
> will need to set these envars in the Control Panel System utility.
>
> How exactly are you invoking java?
>


Java is invoked via Ant: "ant run" for example, don't know how Ant
tasks find the JRE...

Anyway I had C:\dev\jdk1.5.0_11\bin on my PATH= var at the second to
last position, now that I put that concrete entry before any
%SYSTEMROOT% (all Windows dirs/subdirs like system32) it works fine
now (only need to recreate a new shell window which is ok for me).

Karsten

 
Reply With Quote
 
dani.belz@googlemail.com
Guest
Posts: n/a
 
      05-22-2007
On 21 Mai, 11:18, Karsten Wutzke <(E-Mail Removed)> wrote:

Hi Karten,

> Anyway I had C:\dev\jdk1.5.0_11\bin on my PATH= var at the second to
> last position, now that I put that concrete entry before any
> %SYSTEMROOT% (allWindowsdirs/subdirs like system32) it works fine
> now (only need to recreate a new shell window which is ok for me).


that's because in %SYSTEMROOT% you will also find java.exe,
javac.exe, ... I have absolutely no idea why! Took me some time to
figure this out because you would never think about that. Anyway, I
think it's save to remove them. I have JDK 1.4, 5 and 6 installed and
it works perfectly.

-Dani


 
Reply With Quote
 
dani.belz@googlemail.com
Guest
Posts: n/a
 
      05-22-2007
On 21 Mai, 11:18, Karsten Wutzke <(E-Mail Removed)> wrote:

Hi Karten,

> Anyway I had C:\dev\jdk1.5.0_11\bin on my PATH= var at the second to
> last position, now that I put that concrete entry before any
> %SYSTEMROOT% (allWindowsdirs/subdirs like system32) it works fine
> now (only need to recreate a new shell window which is ok for me).


that's because in %SYSTEMROOT% you will also find java.exe,
javac.exe, ... I have absolutely no idea why! Took my some time to
figure this out because you would never think about that. Anyway, I
think it's save to remove them. I have JDK 1.4, 5 and 6 installed and
it works perfectly.

-Dani


 
Reply With Quote
 
ilya.khen@gmail.com
Guest
Posts: n/a
 
      05-23-2007
Hi,

I do have the same kind of problem with my browser.
JRE 6 and JRE 5 are installed on my machine, but whenever some applet
loads in browser, JRE 6 starts to react. It is good, but what if I
would like to use JRE 5 or JRE 6 by choose?
How to switch between JREs in respect to browser?

-Merlin

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DirectX End-User Runtimes (August 2007) available =?Utf-8?B?Q2FybG9z?= Windows 64bit 0 09-11-2007 10:42 PM
DirectX End-User Runtimes (Aug 2007) =?Utf-8?B?Q2FybG9z?= Windows 64bit 4 07-29-2007 04:09 PM
Gauging interest for experimental software platform/runtime/language with main goals being ease-of-use and "building-block style" seamless reusability over distributed runtimes... gavinconrad85@gmail.com Java 1 04-27-2007 03:53 AM
multiple runtimes on a Win2000 server and IIS 5 SRussell ASP .Net 0 11-13-2006 03:07 PM
StackOverflowException in .NET Runtimes =?Utf-8?B?Qy5EaW1pdHJvdg==?= ASP .Net 1 07-25-2005 07:43 PM



Advertisments