Installing Oracle (sun) Java 1.7u1 openSUSE 12.1

16 Nov

As many of you know, SUSE decided to drop Oracle Java starting with openSUSE 12.1. This decision was due to licensing changes, that we all knew were coming once Oracle swallowed up SUN Microsystems (R.I.P. SUN & OpenOffice).

So, if you still require the Oracle JDK, then here’s how you install it (I require it for work reasons (Juniper VPN)).

Download the RPM version of Java from (in my case I downloaded 1.7u1).

The one I downloaded was: jdk-7u1-linux-i586.rpm

Install the jdk with yast2, zypper, or by double clicking the rpm within dolphin or nautilus:

sudo zypper in jdk-7u1-linux-i586.rpm -y

Now you have to setup the alternatives so you can use switch between Iced Tea, which is default, and the Oracle Java.

First install the alternative:

sudo /usr/sbin/update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.7.0_01/bin/java" 40

Now install the alternative for your browser plugin:

sudo /usr/sbin/update-alternatives --install "/usr/lib/browser-plugins/" "javaplugin" "/usr/java/jdk1.7.0_01/jre/lib/i386/" 40

Note: the first quotes are pointing to the path, the the name of the alternative script, and the 3rd is the location to point to. The numbers at the end is the priority in case it was set to automode.

Now you have to configure the alternatives, first we’ll do java:

sudo /usr/sbin/update-alternatives --config java

Choose the number associated with /usr/java/jdk1.7.0_01/bin/java, in my case it was 1.

Now lets configure javaplugin:

sudo /usr/sbin/update-alternatives --config javaplugin

Choose the number associated with /usr/java/jdk1.7.0_01/jre/lib/i386/, in my case it was 1.

You’re all set, now when you go to your browser, go to about:plugins, and you’ll be able to see something like below:
openSUSE 12.1 Browser Plugin

First, for the haters. I do linux for a living on servers, so I’m used to sudo, and that’s why I use it on my laptop.

Second, also for the other haters. Yes, I could have added some super high priority and kept it on auto, but I like doing it manually.

For the rest, you can check to see what you currently have set by running:

/usr/sbin/update-alternatives --query (or --display) java (or javaplugin)

You can test your java at oracles website:


I am ben kevan.. Well yeah. .that's about it.

24 thoughts on “Installing Oracle (sun) Java 1.7u1 openSUSE 12.1

  1. Pingback: Links 18/11/2011: Android/Google Support at Motorola | Techrights

  2. Your update-alternatives commands needed additional parameters, at least for me.

    sudo /usr/sbin/update-alternatives –install “/usr/bin/java” “java” “/usr/java/jdk1.7.0_01/bin/java” PRIORITY

    sudo /usr/sbin/update-alternatives –config java

    /usr/sbin/update-alternatives –config javaplugin

    With these adjustments, your procedure worked for me.

  3. Donnie, thanks for the note. I forgot the priority on the first line. I’ve added 40 (which is what I typically use as default for some unknown reason). I had the priority on the second command (for plugin) just missed it on the first, whoops.

    Thank you.

  4. @JulCes just stumbled upon this page… so, if I am not too late with my comment then for x86_64 it should be as follows: ~> sudo /usr/sbin/update-alternatives –install “/usr/lib64/browser-plugins/” “javaplugin” “/usr/java/jdk1.7.0_01/jre/lib/amd64/” 40

  5. Pingback: how to install Java

  6. Hi ben.kevan
    Can you post the same for 64 bit opensuse 12.1?
    the one posted by


    bohabork says:
    November 24, 2011 at 5:56 am

    @JulCes just stumbled upon this page… so, if I am not too late with my comment then for x86_64 it should be as follows: ~> sudo /usr/sbin/update-alternatives –install “/usr/lib64/browser-plugins/” “javaplugin” “/usr/java/jdk1.7.0_01/jre/lib/amd64/” 40

    doesn’t work to start withe: -install should be –install

  7. Hello, I tried this tutorial on openSuse 12.1 x64 but i have problem:

    @linux-vqt0:~> sudo /usr/sbin/update-alternatives java 40
    update-alternatives: error: unknown argument `java’

  8. Beretta021,

    Try doing:

    sudo /usr/sbin/update-alternatives –get-selections to see what you have available. If nothing available, we’ll have to install (create) a java subclass for update-alternatives.

  9. Nice tutorial. It works quite well. It helped me to get freemind working again (It needs only Java 1.4, but does not work with OpenJDK1.6).

    There is just one error:

    “sudo /usr/sbin/update-alternatives java”

    should read

    “sudo –config /usr/sbin/update-alternatives java”

    And the same for javaplugin.

  10. so this is what I did for mine, I am running open suse 12.1 X64

    with java 1.7.0_03 X64

    1. Downloaded the rmp: jdk-7u3-linux-x64.rpm
    2. Installed it, of course. (double clicking the rpm)
    3. As stated above did the following:
    3,1) sudo /usr/sbin/update-alternatives –install “/usr/bin/java” “java” “/usr/java/jdk1.7.0_03/bin/java” 40

    3.2) sudo /usr/sbin/update-alternatives –install “/usr/lib/browser-plugins/” “javaplugin” “/usr/java/jdk1.7.0_03/jre/lib/amd64/” 40

    4. The steps for the update not work for me as stated so after reading through here I made the adjustments as needed and used the following commands
    4.1) sudo /usr/sbin/update-alternatives –config java
    4.1.1) got prompted and chose accordingly

    4.2) sudo /usr/sbin/update-alternatives –config javaplugin
    4.2.1) got prompted and chose accordingly

    Everything seems fine for me except the plugin page on the browser. I’ll work on that later tho.

  11. Pingback: Joar » Regarding java in opensuse

  12. Pingback: Technology And Software » Installing Oracle (sun) Java 1.7u1 openSUSE 12.1 | Free Techie Blog

  13. @bilorge: Do i need all your instructions if i only want to install the runtime environment?

  14. hmm….works not with my 11.4 64bit, any idea?

    I installed jre-7u5-linux-x64.rpm and did all the instructions from bilorge, but at 4.1 suse says:

    There is only 1 program which provides java
    (/usr/lib64/jvm/jre-1.6.0-openjdk/bin/java). Nothing to configure.

    java version “1.6.0_22”
    OpenJDK Runtime Environment (IcedTea6 1.10.4) (suse-0.3.2-x86_64)
    OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

  15. Ok, the runtime environment is there in openSUSE 11.4 64bit, i had to fix some differences in folders:

    1. installing jre-7u5-linux-x64.rpm
    2. /usr/sbin/update-alternatives –install ‘/usr/bin/java’ ‘java’ ‘/usr/java/jre1.7.0_05/bin/java’ 40
    3. /usr/sbin/update-alternatives –install ‘/usr/lib/browser-plugins/’ ‘javaplugin’ ‘/usr/java/jre1.7.0_05/jre/lib/amd64/’ 40
    4. /usr/sbin/update-alternatives –config java

  16. You set javac the same way you set java, but if you need javah, you’ll need to add it as a slave to the javac alternative:

    >/usr/sbin/update-alternatives –install “/usr/bin/javac” “javac” “/usr/java/jdk1.7.0_05/bin/javac” 40 –slave “/usr/bin/javah” “javah” “/usr/java/jdk1.7.0_05/bin/javah”

  17. Pingback: Using juniper network connection VPN on openSUSE 12.2 x86_64 | Free Techie Blog

  18. It worked with Java 1.5 also 😉

    For those who have old applications running on old JBoss servers and are too lazy to port everything.

  19. I’ve seen very long update-alternatives examples with lots of slaves, but most don’t include them. I want everything to point to the new manually installed java. It looks like the slaves are necessary from the output of update-alternatives –query. I don’t know if this will be helpful to others, but it is something I’m looking into — take the update-alternatives command from the /var/log/alternatives.log as a starting point for a bash script. Your blog was helpful and appears near the top in a google search. A lot of people must be searching for this info 🙂 Thx!

  20. Thank a lot for the very good descripüütion. I search a long time for this. It is very helpful. I have done this in opensuse
    12.3 and opensuse 13.1 Beta1.

    Nice greetings


Leave a Reply

Your email address will not be published. Required fields are marked *