Installing openJDK JRE 1.7 alongside openJDK SDK 1.6?

I want to try the openJDK jre 1.7 but only for one program and use 1.6 for everything else (and as the default).

  1. Where do I find the openJDK 1.7 JRE? (it’s not showing up in software management)

  2. How do I ensure when it’s installed that it doesn’t override the paths that point to the 1.6 jre?

[opensuse-factory] OpenJDK7 is going to Factory](http://lists.opensuse.org/opensuse-factory/2012-05/msg00137.html)
Index of /repositories/Java:/openjdk6:/Factory/openSUSE_12.1

And I guess update-alternatives is used to select the default version.

Thanks. Can you elaborate on what “update-alternatives” is and how to use it to install this the way I want?

Also, what URL do I use to add this repo?

It doesn’t play a part in the installation of the software (that’s up to you to do) per se. It’s a command line utility that, for some items, allows you to switch/set the app you want the system to use by default. It should be installed by default on your system IIRC. For more info, read the output of “man update-alternatives”.

As an example:

update-alternatives --config java

will allow you to switch between installed versions as the system default java to run.

As you are intending to only use one app with 1.7, if that particular app allows you to config the path to the java version you want to use (and is also cognizant of the respective java environment variables), then you won’t even need to be switching back and forth via update-alternatives.

Thanks, two questions:

  1. What URL do I use to add the repo?

  2. How do I install only the JRE? (Looking at the links, I find only full sdk install options)

As provided by RedDwarf above: Index of /repositories/Java:/openjdk6:/Factory/openSUSE_12.1

  1. How do I install only the JRE? (Looking at the links, I find only full sdk install options)
    there are separate downloads the jre and sdk. Not sure what you are looking at or missing.

Thanks I installed that but now (as I did not want) JRE 1.7 has replaced 1.6 (even though both are installed) When I type “java -version” on the command line it saya 1.7. How do I get 1.6 back?

EDIT: What’s weird is I have a file “/usr/bin/java” but that file is NOT in the “file list” of any of the packages!

When I try using update-alternatives, it doesn’t work:


sudo /usr/sbin/update-alternatives --install "/usr/bin/java" "java" "/usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/bin/java" 1
update-alternatives: warning: forcing reinstallation of alternative /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java because link group java is broken.
update-alternatives: warning: not replacing /usr/share/applications/policytool.desktop with a link.

I solved this by using “sudo update-alternatives --config java”, which then showed me the following choices:


  Selection    Path                                                  Priority   Status
------------------------------------------------------------
* 0            /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java              17147     auto mode
  1            /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/bin/java   1         manual mode
  2            /usr/lib64/jvm/jre-1.6.0-openjdk/bin/java              17105     manual mode                                                                                                                                                                                
  3            /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java              17147     manual mode 

I’m guessing the “1” choice was just created by me. I see that the path it expects is “/usr/lib64/jvm/jre-…” not “/usr/lib64/jvm/java…” even though the latter is what exists in the file list in Software Management for the packages. How confusing and unclear!

I see further on in the thread you discovered the wonders of update-alternatives :wink:

EDIT: What’s weird is I have a file “/usr/bin/java” but that file is NOT in the “file list” of any of the packages!
/usr/bin/java is just a symbolic link … in your file manager, dolphin for example, right click on the file and select properties, and it should display the target … for me, that happens to be /etc/alternatives/java … which is, itself, a smybolic link that points to … eventually going down the garden path you get to the actual java app.