Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Installing JDK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Installing JDK" Watch "Installing JDK" New topic
Author

Installing JDK

Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
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

Joined: Oct 13, 2005
Posts: 38007
    
  22
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

    Joined: Oct 13, 2005
    Posts: 38007
        
      22
    Have you had any luck?
    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

    Joined: Dec 27, 2005
    Posts: 42

    anyways, Ritchie, thanks a lot for the reply..


    Originally posted by Campbell Ritchie:
    Have you had any luck?
    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

    Joined: Nov 24, 2005
    Posts: 14687
        
      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 :


    [My Blog]
    All roads lead to JavaRanch
    camilo lopes
    Ranch Hand

    Joined: Aug 08, 2007
    Posts: 202
    only The directories are differents! the o local is default.


    Brazil - Sun Certified Java Programmer - SCJP 5
    http://www.camilolopes.com/ About Java - Update every Week.
    Guide SCJP - tips that you need know http://blog.camilolopes.com.br/livrosrevistaspalestras/
    Campbell Ritchie
    Sheriff

    Joined: Oct 13, 2005
    Posts: 38007
        
      22
    I thought there was a way to do it on Windows. I had forgotten about .bat files. Thank you.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Installing JDK
     
    Similar Threads
    Eclipse not getting started
    Wanted: Regular Expression Lessons Critics
    Eclipse not getting started
    What version of JDK and TomCat?
    Problem in running Tomcat 5.5.9 as service