• Post Reply Bookmark Topic Watch Topic
  • New Topic

can two jdk versions coexist?  RSS feed

 
sonny kher
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can I have two different versions of Java live on the same box and depending on the path settings for a user, use one over the other?
Because I don't see any common files, has anyone tried doing it. The Sun download site clearly says "Uninstall the previous version before installing the new version"
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - For Linux, absolutely yes, I do it all the time.
User 1:
export JAVA_HOME=/opt/jdk1.3.1
export PATH=$JAVA_HOME/bin:$PATH
User 2:
export JAVA_HOME=/opt/jdk1.4.0
export PATH=$JAVA_HOME/bin:$PATH
You can even flip/flop on the fly, or have the same user using different JDKs on different terminals.
Regards, Guy
[ November 26, 2002: Message edited by: Guy Allard ]
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, this is definitely possible.
Usually, I use symbolic links rather than having to change my environment settings
i.e. ln -s /usr/java/jdk1.3.1_03 jdk
So my PATH/JDK_HOME/JAVA_HOME is always ~/jdk, and I just change the symlink whenever I need to switch from 1.3.1 and 1.4.0 or whatever
I also do this on any winnt style platforms using the rather good "junction" command available from the always useful www.sysinternals.com
 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May One user have two jdk installations and use them alternately as wish?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. Set up two environment variables, each of which points to an installation. Then use JAVA_HOME or similar variables to point to them as desired. Ex:
JDK14=/usr/java1.4
JDK13=/usr/java1.3
JAVA_HOME=${JDK14}
PATH=${JAVA_HOME}/bin:${PATH}
If you want to get really fancy, you could write each setup to a separate file and use the source command of your favorite interpreter to make changes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!