# Installing JDK

Jim Patrick
Ranch Hand
Posts: 42
Hi

could we install two different versions of JDK(eg: JDK 1.4 and JDK 5.0) in different directories under c: in WINXP ?

if yes, then which JDK(JDK 1.4 or JDK 5.0) to install first and how to set classpath and path in environment variables?

Rgds,
Jim.
[ March 08, 2008: Message edited by: Jim Patrick ]

Campbell Ritchie
Sheriff
Posts: 49367
62
Install them both in their default folders, on Windows maybe
• c:\Program Files\Java\jdk1.4.2_12
• c:\Program Files\java\jdk1.6.0_04
• Set up the PATH to point to one of them, usually the most recent.
You can set up the PATH from a command prompt, but I can't remember how to do it. There is more about PATHs here. If you want to use the 1.4.2 you would have to prepend c:\Program Files\Java\jdk1.4.2_12\bin\ to the java, javac etc. commands. You might need to put quotes around it if the line contains whitespace like thisTry that and see how you get on with it.

Campbell Ritchie
Sheriff
Posts: 49367
62
I said you can alter the PATH from the command prompt, but that might only be possible from a terminal window on Linux/Unix. You would write
export PATH=/usr/java/jdk1.4.0_12/bin/:\$PATH (or similar)
in Linux and it would change the PATH until you close that terminal, but I haven't found how to do it on Windows. Sorry.

Jim Patrick
Ranch Hand
Posts: 42
anyways, Ritchie, thanks a lot for the reply..

Originally posted by Campbell Ritchie:
I said you can alter the PATH from the command prompt, but that might only be possible from a terminal window on Linux/Unix. You would write
export PATH=/usr/java/jdk1.4.0_12/bin/:\$PATH (or similar)
in Linux and it would change the PATH until you close that terminal, but I haven't found how to do it on Windows. Sorry.

Christophe Verré
Sheriff
Posts: 14691
16
I have different version of the JDK on my machine. I use BAT files to set the proper PATH and JAVA_HOME.
For example, here is one :

And here is another :

camilo lopes
Ranch Hand
Posts: 202
only The directories are differents! the o local is default.

Campbell Ritchie
Sheriff
Posts: 49367
62
I thought there was a way to do it on Windows. I had forgotten about .bat files. Thank you.