how to install an older version of java?

Hi,

I’m using Open suse 11.0. When I installed it, I chose all the software packages and it installed Java_1.6_0 as a part of it.
Now I would like to install Java_1.5_x (as the code that I am trying to run hasn’t yet been tested in 6.0). I’ve downloaded the rpm.bin file and have installed it as mentioned in the documentation.
However, when I do a ‘java -version’ in the command prompt, it shows 1.6_0. It seems like linux won’t let me install an older version without uninstalling the later version.

Can anyone help in going about this? If there is a work around to uninstalling, please let me know that as well.

Thanks,

Soubhik

PS: I had set the $JAVA_HOME variable to a version 5.0x but the code gave an error because it didn’t point to 6.0x, the currently installed version. So I had to change it.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

JAVA_HOME doesn’t really matter much when it comes to executables…
when you run ‘java -version’ all that matters is where the system finds
‘java’ which is in $PATH so update PATH as the following:

export PATH=/path/to/your/new/jvm/bin:$PATH
java -version

And that should show your new (old) version properly.

Good luck.

effikc wrote:
> Hi,
>
> I’m using Open suse 11.0. When I installed it, I chose all the software
> packages and it installed Java_1.6_0 as a part of it.
> Now I would like to install Java_1.5_x (as the code that I am trying to
> run hasn’t yet been tested in 6.0). I’ve downloaded the rpm.bin file and
> have installed it as mentioned in the documentation.
> However, when I do a ‘java -version’ in the command prompt, it shows
> 1.6_0. It seems like linux won’t let me install an older version
> without uninstalling the later version.
>
> Can anyone help in going about this? If there is a work around to
> uninstalling, please let me know that as well.
>
> Thanks,
>
> Soubhik
>
> PS: I had set the $JAVA_HOME variable to a version 5.0x but the code
> gave an error because it didn’t point to 6.0x, the currently installed
> version. So I had to change it.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIo0Ck3s42bA80+9kRAjOhAJ9lMk8v/IBYtVJVqstXXBvBddneUACfevuT
M1oXyXuxLZMb78o/h6LCaYM=
=dwbO
-----END PGP SIGNATURE-----

From Yast, you should be able
to select an older package by
searching for java while in the
“installed,” section. Lower
bottom right corner has the
version number currently installed.
Click there, and there SHOULD
be older versions available.
It SHOULD also warn you about dependencies if any…

Hope this helps!

the java binaries are actually installed with their version number postfixed to them (ex. java-X.x or something like that). the ‘java’ command is a symbolic link to the most current java installed. YAST/rpm handle keeping this link up to date. The easy way to run an older version of java is to call it directly. I’m at work right now and don’t have access to SUSE but here is how you can find it:

-do a ‘which java’ command to find out where the symbolic link is located
-change directory to that location and do a ‘ll | grep java’
-the java command should have an ‘->’ next to it that points the location of the binary it’s linked to.
-The java binaries should all be installed in the same directory, so go to the directory that you found from above and look for ‘java1.5’ or something like that.

Good luck!

No, keep them both installed.

This seems to be a relatively well-kept secret. ‘su’ to root and type:

update-alternatives --config java

It’s designed to allow you to have multiple editions, just as you want,
and to easily switch to whichever version you want to use. :cool:

[Of course, it works for stuff beside just java. See ‘man update-alternatives’
for the gory details.]

Just got home, instead of looking for java1.5 etc, look for ‘jre-1.5.0’ sorry about that.

Thanks to every body who replied to my question. However, this solution seemed to be the simplest and I tried it. And it worked. (Well at least it is showing the correct version of JAVA that I want).

[QUOTE=ab@novell.com;1856214]-----BEGIN PGP SIGNED MESSAGE-----

when you run ‘java -version’ all that matters is where the system finds
‘java’ which is in $PATH so update PATH as the following:

export PATH=/path/to/your/new/jvm/bin:$PATH
java -version

However a question which still remains.
Do I need to run the export command every time I start a new xterm window? Or is the change to this version of JAVA permanent?

Yes…I can see the java version I want under jdk. But how do I install it to make it the default version?

Try doing the ‘update-alternatives’ that I showed above and
then choose it’s number, even if there is only one choice!

That should make it operational. And it should set up all necessary
environment variables, including JAVA_HOME. Don’t set that yourself.