Installing both of JDK 1.4.x and 1.5.x

Frank Merenda fmerenda at yahoo.com
Thu Apr 7 21:53:37 UTC 2005


Behrang Saeedzadeh <behrangsa <at> gmail.com> writes:
> Has anybody installed two different versions of JDK (1.4.x and 1.5.x in my 
> case) on his system? I have projects that have to be compiled with 1.4.x and 
> projects that must be compiled with 1.5.x.

Hello there! 
I do this on my machine.

I untar the JDK's from sun into "/usr/java/". Then I symlink /usr/java/MYJDK to
/usr/java, i.e.

ln -s /usr/java/jdk1.5.0 /usr/java/jdk

so I end up with something like this:

[/usr/java]
[root]$ ls -l
total 8
drwxrwxr-x  9 fmerenda fmerenda 4096 Oct 21 16:11 j2sdk1.4.2_06
lrwxrwxrwx  1 fmerenda fmerenda    8 Mar 29 23:43 jdk -> jdk1.5.0
drwxr-xr-x  9 fmerenda fmerenda 4096 Sep 15  2004 jdk1.5.0

I also then symlink
/usr/bin/java to /usr/java/jdk/bin/java

and

/usr/bin/javac to /usr/java/jdk/bin/javac

Then I can change my JDK just by changing where the symlink 
"/usr/java/jdk" points to.

Tools like eclipse will also find all of your installed JDK's automatically (at
least it works with mine that are in /usr/java).

You can also set up scripts to export your JAVA_HOME environment variables if
you want to switch back and forth easily.

Hope this helps,
-Frank





More information about the ubuntu-users mailing list