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 Running jdk 1.5 and 1.6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Running jdk 1.5 and 1.6" Watch "Running jdk 1.5 and 1.6" New topic
Author

Running jdk 1.5 and 1.6

Lisa Zapson
Ranch Hand

Joined: Nov 22, 2004
Posts: 50
I am running applications that use jdk 1.5 and 1.6. How can I toggle between the two without having to add/remove programs?

Thanks, Lisa
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8705
    
    6

Applications written for 1.5 should run under 1.6. JDK's so far have been backwards compatible.
I run several web and application servers, which do tend to be developed for a particular JDK. In that case I write a batch file to set the PATH and JAVA_HOME environment variables to a particular version.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Specify the absolute path of the java.exe or javaw.exe that you want to use. So instead of

you type

Note how I added double quotes around the path - it is needed if there is a space somewhere in the path. Given that most people install the JRE and JDK in C:\Program Files, it's probably needed.

The java.exe and javaw.exe in C:\WINDOWS\system32 are nothing more than wrapper files. They check a part of the registry for the location of the JRE, then execute the java.exe / javaw.exe in that location. When you install a new JRE it changes the registry to say the new JRE should be used, but the old one can still be executed.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Lisa Zapson
Ranch Hand

Joined: Nov 22, 2004
Posts: 50
Your information was very helpful, thanks.

By any chance do you know how I can toggle java 1.5 and 1.6 for web start?

Thanks, Lisa
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8705
    
    6

Apparently you can specify the JDK version in the JNLP file:
My application requires a specific version of the JRE. How do I specify this my JNLP file?

The tag <j2se version="versionNum"> specifies a platform version, where versionNum is 1.2, 1.3, 1.4, or 1.5.

You can request a specific product version by including a vendor URL in the href attribute. For Sun's JREs, the URL is http://java.sun.com/products/autodl/j2se For example, the following J2SE tag will request any Sun 1.3.1 implementation:

<j2se version="1.3.1*" href="http://java.sun.com/products/autodl/j2se"/>

Java Web Start FAQ
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Running jdk 1.5 and 1.6
 
Similar Threads
Bad version number in .class file
WAS 7 with JDK 1.5
Can't run Axis2 1.5.1 under Tomcat 5.5 using JDK 1.5?
Tomcat 6 on JDK 1.6
JDK API Download