SDB:Installing Java

Jump to: navigation, search


Tested on openSUSE

Recommended articles

Icon-manual.png

Related articles

Icon-help.png


This article is about installing Oracle Java on openSUSE.

Situation

Due to Oracle (Sun) licensing policies, Java JRE cannot be included in the repositories of openSUSE anymore. Here is a quick guide on how to install the newest and secure version. On the Oracle Java website two versions are available for downloading:

  • Java Runtime Environment (JRE): includes Java virtual machine), libraries, Java application launcher, web browser and in general everything should be needed to run programs written with Java language.
  • Java Development Kit (JDK): in addition to the Java Runtime Environment (JRE) above, it includes all the tools needed to develop, test and debug programs written with Java language.

The JRE installation is a shorter version of the JDK installation, therefore the procedure to install the JRE will be shown first. Differences with JRE installation should be clearer, should someone want to install just the Java Runtime Environment. Installing both packages when they have the same version number is not (quite) useful.
With both the procedures given below, for JDK and for JRE installation, the same name, i.e. jdk_Oracle, will be used for the symbolic link pointing to the folder where the Oracle Java Environment is located. This way, one might even follow both procedures in a sequence, since the JDK and the JRE are installed in different directories, but only the latter is going to be used by your system (or whichever the symbolic link is pointing to).

NOTE: Before actually proceeding further, read the "Discussion" to this SDB for updates and contributions which may not yet have been accepted to be part of the main SDB.


Java Runtime Environment Install using Oracle's RPM

The purpose of this installation method is to be a quick and easy setup. You will not have the Icedtea Web plugin, only the official Java. This method is recommended for those that require Oracle's Java for websites that insist on the genuine article in order to be accessed.

Determine what architecture you are running before downloading the package to your system. To be certain of your architecture, open a terminal by running the command (Alt+F2 in KDE): konsole or xterm

Execute the command:

uname -m

If the output is:

i586
i686

You have a 32-bit architecture

If the output is:

x86_64

You have a 64-bit architecture

Download the official RPM from Java.com and install the RPM with whatever method you prefer. In most cases, navigating to the RPM in the file manager and clicking on it will install it. Or you can install via the terminal, e.g. run the command (Alt+F2 in KDE): konsole or xterm to open a terminal then type:

su

Enter your root password, this will put you in "Superuser" mode. Navigate, as a normal user, to the location of the download, Firefox or Chrome will typically put it in ~/Downloads

cd ~/Downloads

To install using terminal type:

rpm -ivh jre-8u351-linux-i586.rpm

or, if you downloaded the 64-bit RPM:

rpm -ivh jre-8u351-linux-x64.rpm
Icon-warning.png
Warning: The installation may fail with
error: Failed dependencies:
/usr/sbin/alternatives is needed by jre...

In this case you may create a link

ln -s /usr/sbin/update-alternatives /usr/sbin/alternatives

and run rpm with the --nodeps option as follows:

rpm -ivh --nodeps jre-8u351-linux-i586.rpm

or, if you downloaded the 64-bit RPM:

rpm -ivh --nodeps jre-8u351-linux-x64.rpm

Make sure that /usr/sbin/alternatives is the only failed dependency otherwise you risk breaking the installation.

Icon-warning.png
Warning: Or fails after "Unpacking JAR files..." with
update-alternatives: error: alternative javaws can't be slave of java: it is a slave of ...

In this case (multiple version of java) and depending on the "update-alternative" error, symbolic links have to be created to the new version of java command you want/need to use.

update-alternatives --install  "/usr/bin/java" "java" "/usr/java/jre1.8.0_351-amd64/bin/java" 1

It creates a new link to the java cmd of the version I want to use, and I just need to specify it to my system with :

update-alternatives --config java

And then

 java -version
 java version "1.8.0_351"
 Java(TM) SE Runtime Environment (build 1.8.0_351-b08)
 Java HotSpot(TM) 64-Bit Server VM (build 25.351-b08, mixed mode)

Once the install is complete, you may have to removed icedtea-web. Copy and paste the following into terminal as root:

zypper rm icedtea-web

Agree to remove the package. Once it is complete, copy and paste the following:

update-alternatives --install "/usr/bin/java" "java" "/usr/java/latest/bin/java" 1
update-alternatives --set java /usr/java/latest/bin/java
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/latest/bin/javaws" 1 update-alternatives --set javaws /usr/java/latest/bin/javaws

What we are interested in, is the file libnpjp2.so (that file location can change any time depending on the SUSE version and the jre package version.) which came with the jre package. You can check that file using rpm command.

rpm -ql $(rpm -qa | grep jre) | grep libnpjp2.so

It should return a result with its absolute path.

You can now create a link and point it to your browser plugin. Paste the following command as root.

For 32-bit architecture:

plugin=$(rpm -ql $(rpm -qa | grep jre) | grep libnpjp2.so) && ln -svf "$plugin" /usr/lib/browser-plugins/ 

For 64-bit architecture:

plugin=$(rpm -ql $(rpm -qa | grep jre) | grep libnpjp2.so) && ln -svf "$plugin" /usr/lib64/browser-plugins/

The installation of Java and appropriate links are complete. You can now use Java applets in any web browser on your system. For Java Web Services, you will still need to update the file associations in your desktop environment and/or web browser.

Updating file associations

By removing the `icedtea-web` functionality, you also removed all file associations to OpenJDK from your desktop environment. This means that you will no longer be able to launch Java executables (other than applets) from a web browser or file manager. Installing the Oracle Java RPM does not restore these associations; you will need to re-add them manually. For instance, in KDE Plasma, you must launch System Settings, then activate the Default Applications applet and select File Associations. Use the search box to search for "java". For each relevant file type returned, you will need to add an application association. For example, for application/x-java-archive, you should add an association to "/usr/bin/java -jar %U", and for application/x-java-jnlp-file, you should add an association to "/usr/bin/javaws %U".

Check for the Java Plugin

If you would like to see if the plugin has installed correctly, restart your browser if you have not done so already and enter the following into the address bar. For Firefox 52 ESR and below enter:

about:plugins

For Chrome / Chromium (prior to version 45) enter:

chrome://plugins/

Note that Java is not supported on newer browsers.

Limit Java Disk Usage

Although no icon appears in the menu, there is a Java Control Panel that allows you to easily adjust many settings. In order to access it, open a terminal or in KDE press Alt+F2 to run a command and enter:

jcontrol
  • Click Settings... under Temporary Internet Files
  • Under Disk Space adjust the amount of disk space for storing temporary files to your choosing. 50 to 100 MB should be sufficient.
  • Click OK to close the dialog box and OK to close the Java Control Panel

Java Development Kit installation using Oracle's RPM

Obtaining and installing the rpm package

Like with the JRE, obtain the rpm for your architecture from Oracle's Java website. Install it likewise via

# sudo rpm -ivh jdk-8u5-linux-x64.rpm

(adjust the name of the file if necessary of course :)).

Bash script to gzip manual pages and install update-alternative

Now to include this in update-alternatives (e.g., to have it in your $PATH, use it with Android Studio or similar), you can use the following script (save as some-file-name.sh and run

# sh some-file-name.sh

or make it executable and run it then, whatever you prefer):

#!/bin/bash

sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/appletviewer.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/apt.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/extcheck.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jar.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jarsigner.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/javac.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/javadoc.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/javah.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/javap.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jcmd.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jconsole.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jdb.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jhat.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jinfo.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jmap.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jps.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jrunscript.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jsadebugd.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jstack.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jstat.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/jstatd.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/native2ascii.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/pack200.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/rmic.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/schemagen.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/serialver.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/unpack200.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/wsgen.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/wsimport.1)
sudo gzip $(readlink -f /usr/java/jdk1.8.0_05/man/man1/xjc.1)
sudo /usr/sbin/update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_05/bin/javac 3 --slave /usr/bin/appletviewer appletviewer /usr/java/jdk1.8.0_05/bin/appletviewer --slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/java/jabout:pluginsdk1.8.0_05/man/man1/appletviewer.1.gz --slave /usr/bin/extcheck extcheck /usr/java/jdk1.8.0_05/bin/extcheck --slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/java/jdk1.8.0_05/man/man1/extcheck.1.gz --slave /usr/bin/jar jar /usr/java/jdk1.8.0_05/bin/jar --slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/java/jdk1.8.0_05/man/man1/jar.1.gz --slave /usr/bin/jarsigner jarsigner /usr/java/jdk1.8.0_05/bin/jarsigner --slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/java/jdk1.8.0_05/man/man1/jarsigner.1.gz --slave /usr/lib64/jvm/java java_sdk /usr/java/jdk1.8.0_05 --slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/java/jdk1.8.0_05/man/man1/javac.1.gz --slave /usr/bin/javadoc javadoc /usr/java/jdk1.8.0_05/bin/javadoc --slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/java/jdk1.8.0_05/man/man1/javadoc.1.gz --slave /usr/bin/javah javah /usr/java/jdk1.8.0_05/bin/javah --slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/java/jdk1.8.0_05/man/man1/javah.1.gz --slave /usr/bin/javap javap /usr/java/jdk1.8.0_05/bin/javap --slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/java/jdk1.8.0_05/man/man1/javap.1.gz --slave /usr/share/man/man1/jcmd.1.gz jcmd.1.gz /usr/java/jdk1.8.0_05/man/man1/jcmd.1.gz --slave /usr/bin/jconsole jconsole /usr/java/jdk1.8.0_05/bin/jconsole --slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/java/jdk1.8.0_05/man/man1/jconsole.1.gz --slave /usr/bin/jdb jdb /usr/java/jdk1.8.0_05/bin/jdb --slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/java/jdk1.8.0_05/man/man1/jdb.1.gz --slave /usr/bin/jhat jhat /usr/java/jdk1.8.0_05/bin/jhat --slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/java/jdk1.8.0_05/man/man1/jhat.1.gz --slave /usr/bin/jinfo jinfo /usr/java/jdk1.8.0_05/bin/jinfo --slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/java/jdk1.8.0_05/man/man1/jinfo.1.gz --slave /usr/bin/jmap jmap /usr/java/jdk1.8.0_05/bin/jmap --slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/java/jdk1.8.0_05/man/man1/jmap.1.gz --slave /usr/bin/jps jps /usr/java/jdk1.8.0_05/bin/jps --slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/java/jdk1.8.0_05/man/man1/jps.1.gz --slave /usr/bin/jrunscript jrunscript /usr/java/jdk1.8.0_05/bin/jrunscript --slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/java/jdk1.8.0_05/man/man1/jrunscript.1.gz --slave /usr/bin/jsadebugd jsadebugd /usr/java/jdk1.8.0_05/bin/jsadebugd --slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/java/jdk1.8.0_05/man/man1/jsadebugd.1.gz --slave /usr/bin/jstack jstack /usr/java/jdk1.8.0_05/bin/jstack --slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/java/jdk1.8.0_05/man/man1/jstack.1.gz --slave /usr/bin/jstat jstat /usr/java/jdk1.8.0_05/bin/jstat --slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/java/jdk1.8.0_05/man/man1/jstat.1.gz --slave /usr/bin/jstatd jstatd /usr/java/jdk1.8.0_05/bin/jstatd --slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/java/jdk1.8.0_05/man/man1/jstatd.1.gz --slave /usr/bin/native2ascii native2ascii /usr/java/jdk1.8.0_05/bin/native2ascii --slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/java/jdk1.8.0_05/man/man1/native2ascii.1.gz --slave /usr/bin/pack200 pack200 /usr/java/jdk1.8.0_05/bin/pack200 --slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/java/jdk1.8.0_05/man/man1/pack200.1.gz --slave /usr/bin/rmic rmic /usr/java/jdk1.8.0_05/bin/rmic --slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/java/jdk1.8.0_05/man/man1/rmic.1.gz --slave /usr/bin/schemagen schemagen /usr/java/jdk1.8.0_05/bin/schemagen --slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/java/jdk1.8.0_05/man/man1/schemagen.1.gz --slave /usr/bin/serialver serialver /usr/java/jdk1.8.0_05/bin/serialver --slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/java/jdk1.8.0_05/man/man1/serialver.1.gz --slave /usr/bin/unpack200 unpack200 /usr/java/jdk1.8.0_05/bin/unpack200 --slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/java/jdk1.8.0_05/man/man1/unpack200.1.gz --slave /usr/bin/wsgen wsgen /usr/java/jdk1.8.0_05/bin/wsgen --slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/java/jdk1.8.0_05/man/man1/wsgen.1.gz --slave /usr/bin/wsimport wsimport /usr/java/jdk1.8.0_05/bin/wsimport --slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/java/jdk1.8.0_05/man/man1/wsimport.1.gz --slave /usr/bin/xjc xjc /usr/java/jdk1.8.0_05/bin/xjc --slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/java/jdk1.8.0_05/man/man1/xjc.1.gz


Procedure with development kit included (JDK)

Icon-warning.png

The original author of this text does not describe what makes this section different than the immediately preceding but may be to describe how to install Oracle SE 7 which has a different directory layout than later Oracle SE. In any case, to install Oracle SE JDK 7 (32-bit or 64-bit), the User may wish to use the scripts at the following location which makes installation simple and easy(replaces everything that follows in this section completely). Unless Oracle for some reason decides to release a yet later version, the scripts should work as-is, but if needed can be edited as needed (pls submit an Issue if such an edit is needed)

https://github.com/putztzu/openSUSE_Oracle_Java_Install

.


Full Java Environment included.

Icon-warning.png
Warning: From here to the end of this section, for any sub-section (Updating Oracle Java included), if your system has a 64-bit architecture, any occurrence of /usr/lib must be replaced with /usr/lib64. Please follow the appropriate subsections for your system architecture, when you are inserting the commands.

Install Oracle Java SE

  • Download Oracle Java SE Development Kit (JDK) from the Oracle Java website. Save it to an easy to remember directory (eg. /tmp)
Download a suitable version for your system architecture. E.g.: with Oracle Java version 1.7.0_7:
Linux x86 (32-bit architecture)
jdk-7u7-linux-i586.tar.gz
Linux x64 (64-bit architecture)
jdk-7u7-linux-x64.tar.gz
  • Open a terminal and run:
    cd /path/to/downloaded/java
  • Decompress it with (as root, just to be sure):
    sudo tar -xzf ./jdk-7uX-linux-XX.tar.gz
  • Fix permissions for the expanded directory and its content:
    sudo chown -R root:root jdk1.X.X_XX/
Linux x86 (32-bit architecture)
  • Open JDK is installed by default in /usr/lib, so let's move Oracle Java to /usr/lib as well:
    sudo mv ./jdk1.X.X_XX/ /usr/lib/
  • Create a symbolic link to /usr/lib/jdk1.X.X_XX/ (this will be important later for updating):
    sudo ln -s -T /usr/lib/jdk1.X.X_XX/ /usr/lib/jdk_Oracle
Linux x86_64 (64-bit architecture)
  • Open JDK is installed by default in /usr/lib64, so let's move Oracle Java to /usr/lib64 as well:
    sudo mv ./jdk1.X.X_XX/ /usr/lib64/
  • Create a symbolic link to /usr/lib64/jdk1.X.X_XX/ (this will be important later for updating):
    sudo ln -s -T /usr/lib64/jdk1.X.X_XX/ /usr/lib64/jdk_Oracle

Inform the system

Java application launcher

  • Compress the man files involved in your installation:
Linux x86 (32-bit architecture)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/java.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/policytool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmid.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmiregistry.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/servertool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/tnameserv.1)
Linux x86_64 (64-bit architecture)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/java.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/policytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmid.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/servertool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/tnameserv.1)
  • Prepare the directory for jvm-exports (specific for version 1.7.0):
Linux x86 (32-bit architecture)
  1. sudo mkdir /usr/lib/jvm-exports/jdk_Oracle
    cd /usr/lib/jvm-exports/jdk_Oracle
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jaas-1.7.0_Orac.jar
    sudo ln -s jaas-1.7.0_Orac.jar jaas-1.7.0.jar
    sudo ln -s jaas-1.7.0_Orac.jar jaas.jar
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/jce.jar jce-1.7.0_Orac.jar
    sudo ln -s jce-1.7.0_Orac.jar jce-1.7.0.jar
    sudo ln -s jce-1.7.0_Orac.jar jce.jar
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jdbc-stdext-1.7.0_Orac.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-1.7.0.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-3.0.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext.jar
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jndi-1.7.0_Orac.jar
    sudo ln -s jndi-1.7.0_Orac.jar jndi-1.7.0.jar
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jndi-cos-1.7.0_Orac.jar
    sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos-1.7.0.jar
    sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos.jar
    sudo ln -s jndi-1.7.0_Orac.jar jndi.jar
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jndi-ldap-1.7.0_Orac.jar
    sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap-1.7.0.jar
    sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap.jar
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jndi-rmi-1.7.0_Orac.jar
    sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi-1.7.0.jar
    sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi.jar
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/jsse.jar jsse-1.7.0_Orac.jar
    sudo ln -s jsse-1.7.0_Orac.jar jsse-1.7.0.jar
    sudo ln -s jsse-1.7.0_Orac.jar jsse.jar
    sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar sasl-1.7.0_Orac.jar
    sudo ln -s sasl-1.7.0_Orac.jar sasl-1.7.0.jar
    sudo ln -s sasl-1.7.0_Orac.jar sasl.jar
  2. sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib/jvm/jre jre /usr/lib/jdk_Oracle/jre --slave /usr/lib/jvm-exports/jre jre_exports /usr/lib/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib/jdk_Oracle/man/man1/tnameserv.1.gz
Linux x86_64 (64-bit architecture)
  1. sudo mkdir /usr/lib64/jvm-exports/jdk_Oracle
    cd /usr/lib64/jvm-exports/jdk_Oracle
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jaas-1.7.0_Orac.jar
    sudo ln -s jaas-1.7.0_Orac.jar jaas-1.7.0.jar
    sudo ln -s jaas-1.7.0_Orac.jar jaas.jar
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/jce.jar jce-1.7.0_Orac.jar
    sudo ln -s jce-1.7.0_Orac.jar jce-1.7.0.jar
    sudo ln -s jce-1.7.0_Orac.jar jce.jar
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jdbc-stdext-1.7.0_Orac.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-1.7.0.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-3.0.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext.jar
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-1.7.0_Orac.jar
    sudo ln -s jndi-1.7.0_Orac.jar jndi-1.7.0.jar
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-cos-1.7.0_Orac.jar
    sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos-1.7.0.jar
    sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos.jar
    sudo ln -s jndi-1.7.0_Orac.jar jndi.jar
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-ldap-1.7.0_Orac.jar
    sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap-1.7.0.jar
    sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap.jar
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-rmi-1.7.0_Orac.jar
    sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi-1.7.0.jar
    sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi.jar
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/jsse.jar jsse-1.7.0_Orac.jar
    sudo ln -s jsse-1.7.0_Orac.jar jsse-1.7.0.jar
    sudo ln -s jsse-1.7.0_Orac.jar jsse.jar
    sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar sasl-1.7.0_Orac.jar
    sudo ln -s sasl-1.7.0_Orac.jar sasl-1.7.0.jar
    sudo ln -s sasl-1.7.0_Orac.jar sasl.jar
  2. sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib64/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib64/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib64/jvm/jre jre /usr/lib64/jdk_Oracle/jre --slave /usr/lib64/jvm-exports/jre jre_exports /usr/lib64/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib64/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib64/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib64/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib64/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib64/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib64/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib64/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib64/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib64/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib64/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib64/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib64/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib64/jdk_Oracle/man/man1/tnameserv.1.gz

Java compiler

  • Compress the man files involved in your installation:
Linux x86 (32-bit architecture)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/appletviewer.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/apt.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/extcheck.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jar.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jarsigner.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/javac.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/javadoc.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/javah.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/javap.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jcmd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jconsole.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jdb.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jhat.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jinfo.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jmap.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jps.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jrunscript.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jsadebugd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jstack.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jstat.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jstatd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/native2ascii.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/pack200.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmic.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/schemagen.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/serialver.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/unpack200.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/wsgen.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/wsimport.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/xjc.1)

(Directory for jvm-exports: Same as above for Launcher.)

sudo /usr/sbin/update-alternatives --install /usr/bin/javac javac /usr/lib/jdk_Oracle/bin/javac 3 \
--slave /usr/bin/appletviewer appletviewer /usr/lib/jdk_Oracle/bin/appletviewer \
--slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/lib/jdk_Oracle/man/man1/appletviewer.1.gz \
--slave /usr/bin/apt apt /usr/lib/jdk_Oracle/bin/apt \
--slave /usr/share/man/man1/apt.1.gz apt.1.gz /usr/lib/jdk_Oracle/man/man1/apt.1.gz \
--slave /usr/bin/extcheck extcheck /usr/lib/jdk_Oracle/bin/extcheck \
--slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/lib/jdk_Oracle/man/man1/extcheck.1.gz \
--slave /usr/bin/jar jar /usr/lib/jdk_Oracle/bin/jar \
--slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/lib/jdk_Oracle/man/man1/jar.1.gz \
--slave /usr/bin/jarsigner jarsigner /usr/lib/jdk_Oracle/bin/jarsigner \
--slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/lib/jdk_Oracle/man/man1/jarsigner.1.gz \
--slave /usr/lib/jvm/java java_sdk /usr/lib/jdk_Oracle \
--slave /usr/lib/jvm-exports/java java_sdk_exports /usr/lib/jvm-exports/jdk_Oracle \
--slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib/jdk_Oracle/man/man1/javac.1.gz \
--slave /usr/bin/javadoc javadoc /usr/lib/jdk_Oracle/bin/javadoc \
--slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/lib/jdk_Oracle/man/man1/javadoc.1.gz \
--slave /usr/bin/javah javah /usr/lib/jdk_Oracle/bin/javah \
--slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/lib/jdk_Oracle/man/man1/javah.1.gz \
--slave /usr/bin/javap javap /usr/lib/jdk_Oracle/bin/javap \
--slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/lib/jdk_Oracle/man/man1/javap.1.gz \
--slave /usr/share/man/man1/jcmd.1.gz jcmd.1.gz /usr/lib/jdk_Oracle/man/man1/jcmd.1.gz \
--slave /usr/bin/jconsole jconsole /usr/lib/jdk_Oracle/bin/jconsole \
--slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/lib/jdk_Oracle/man/man1/jconsole.1.gz \
--slave /usr/bin/jdb jdb /usr/lib/jdk_Oracle/bin/jdb \
--slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/lib/jdk_Oracle/man/man1/jdb.1.gz \
--slave /usr/bin/jhat jhat /usr/lib/jdk_Oracle/bin/jhat \
--slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/lib/jdk_Oracle/man/man1/jhat.1.gz \
--slave /usr/bin/jinfo jinfo /usr/lib/jdk_Oracle/bin/jinfo \
--slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/lib/jdk_Oracle/man/man1/jinfo.1.gz \
--slave /usr/bin/jmap jmap /usr/lib/jdk_Oracle/bin/jmap \
--slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/lib/jdk_Oracle/man/man1/jmap.1.gz \
--slave /usr/bin/jps jps /usr/lib/jdk_Oracle/bin/jps \
--slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/lib/jdk_Oracle/man/man1/jps.1.gz \
--slave /usr/bin/jrunscript jrunscript /usr/lib/jdk_Oracle/bin/jrunscript \
--slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/lib/jdk_Oracle/man/man1/jrunscript.1.gz \
--slave /usr/bin/jsadebugd jsadebugd /usr/lib/jdk_Oracle/bin/jsadebugd \
--slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/lib/jdk_Oracle/man/man1/jsadebugd.1.gz \
--slave /usr/bin/jstack jstack /usr/lib/jdk_Oracle/bin/jstack \
--slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/lib/jdk_Oracle/man/man1/jstack.1.gz \
--slave /usr/bin/jstat jstat /usr/lib/jdk_Oracle/bin/jstat \
--slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/lib/jdk_Oracle/man/man1/jstat.1.gz \
--slave /usr/bin/jstatd jstatd /usr/lib/jdk_Oracle/bin/jstatd \
--slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/lib/jdk_Oracle/man/man1/jstatd.1.gz \
--slave /usr/bin/native2ascii native2ascii /usr/lib/jdk_Oracle/bin/native2ascii \
--slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/lib/jdk_Oracle/man/man1/native2ascii.1.gz \
--slave /usr/bin/pack200 pack200 /usr/lib/jdk_Oracle/bin/pack200 \
--slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/lib/jdk_Oracle/man/man1/pack200.1.gz \
--slave /usr/bin/rmic rmic /usr/lib/jdk_Oracle/bin/rmic \
--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/lib/jdk_Oracle/man/man1/rmic.1.gz \
--slave /usr/bin/schemagen schemagen /usr/lib/jdk_Oracle/bin/schemagen \
--slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/lib/jdk_Oracle/man/man1/schemagen.1.gz \
--slave /usr/bin/serialver serialver /usr/lib/jdk_Oracle/bin/serialver \
--slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/lib/jdk_Oracle/man/man1/serialver.1.gz \
--slave /usr/bin/unpack200 unpack200 /usr/lib/jdk_Oracle/bin/unpack200 \
--slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/lib/jdk_Oracle/man/man1/unpack200.1.gz \
--slave /usr/bin/wsgen wsgen /usr/lib/jdk_Oracle/bin/wsgen \
--slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/lib/jdk_Oracle/man/man1/wsgen.1.gz \
--slave /usr/bin/wsimport wsimport /usr/lib/jdk_Oracle/bin/wsimport \
--slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/lib/jdk_Oracle/man/man1/wsimport.1.gz \
--slave /usr/bin/xjc xjc /usr/lib/jdk_Oracle/bin/xjc \
--slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/lib/jdk_Oracle/man/man1/xjc.1.gz
Linux x86_64 (64-bit architecture)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/appletviewer.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/apt.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/extcheck.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jar.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jarsigner.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javac.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javadoc.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javah.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javap.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jcmd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jconsole.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jdb.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jhat.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jinfo.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jmap.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jps.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jrunscript.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jsadebugd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstack.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstat.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstatd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/native2ascii.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/pack200.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmic.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/schemagen.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/serialver.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/unpack200.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/wsgen.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/wsimport.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/xjc.1)

(Directory for jvm-exports: Same used above for Launcher.)

sudo /usr/sbin/update-alternatives --install /usr/bin/javac javac /usr/lib64/jdk_Oracle/bin/javac 3 \
--slave /usr/bin/appletviewer appletviewer /usr/lib64/jdk_Oracle/bin/appletviewer \
--slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/lib64/jdk_Oracle/man/man1/appletviewer.1.gz \
--slave /usr/bin/apt apt /usr/lib64/jdk_Oracle/bin/apt \
--slave /usr/share/man/man1/apt.1.gz apt.1.gz /usr/lib64/jdk_Oracle/man/man1/apt.1.gz \
--slave /usr/bin/extcheck extcheck /usr/lib64/jdk_Oracle/bin/extcheck \
--slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/lib64/jdk_Oracle/man/man1/extcheck.1.gz \
--slave /usr/bin/jar jar /usr/lib64/jdk_Oracle/bin/jar \
--slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/lib64/jdk_Oracle/man/man1/jar.1.gz \
--slave /usr/bin/jarsigner jarsigner /usr/lib64/jdk_Oracle/bin/jarsigner \
--slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/lib64/jdk_Oracle/man/man1/jarsigner.1.gz \
--slave /usr/lib64/jvm/java java_sdk /usr/lib64/jdk_Oracle \
--slave /usr/lib64/jvm-exports/java java_sdk_exports /usr/lib64/jvm-exports/jdk_Oracle \
--slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib64/jdk_Oracle/man/man1/javac.1.gz \
--slave /usr/bin/javadoc javadoc /usr/lib64/jdk_Oracle/bin/javadoc \
--slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/lib64/jdk_Oracle/man/man1/javadoc.1.gz \
--slave /usr/bin/javah javah /usr/lib64/jdk_Oracle/bin/javah \
--slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/lib64/jdk_Oracle/man/man1/javah.1.gz \
--slave /usr/bin/javap javap /usr/lib64/jdk_Oracle/bin/javap \
--slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/lib64/jdk_Oracle/man/man1/javap.1.gz \
--slave /usr/share/man/man1/jcmd.1.gz jcmd.1.gz /usr/lib64/jdk_Oracle/man/man1/jcmd.1.gz \
--slave /usr/bin/jconsole jconsole /usr/lib64/jdk_Oracle/bin/jconsole \
--slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/lib64/jdk_Oracle/man/man1/jconsole.1.gz \
--slave /usr/bin/jdb jdb /usr/lib64/jdk_Oracle/bin/jdb \
--slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/lib64/jdk_Oracle/man/man1/jdb.1.gz \
--slave /usr/bin/jhat jhat /usr/lib64/jdk_Oracle/bin/jhat \
--slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/lib64/jdk_Oracle/man/man1/jhat.1.gz \
--slave /usr/bin/jinfo jinfo /usr/lib64/jdk_Oracle/bin/jinfo \
--slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/lib64/jdk_Oracle/man/man1/jinfo.1.gz \
--slave /usr/bin/jmap jmap /usr/lib64/jdk_Oracle/bin/jmap \
--slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/lib64/jdk_Oracle/man/man1/jmap.1.gz \
--slave /usr/bin/jps jps /usr/lib64/jdk_Oracle/bin/jps \
--slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/lib64/jdk_Oracle/man/man1/jps.1.gz \
--slave /usr/bin/jrunscript jrunscript /usr/lib64/jdk_Oracle/bin/jrunscript \
--slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/lib64/jdk_Oracle/man/man1/jrunscript.1.gz \
--slave /usr/bin/jsadebugd jsadebugd /usr/lib64/jdk_Oracle/bin/jsadebugd \
--slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/lib64/jdk_Oracle/man/man1/jsadebugd.1.gz \
--slave /usr/bin/jstack jstack /usr/lib64/jdk_Oracle/bin/jstack \
--slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/lib64/jdk_Oracle/man/man1/jstack.1.gz \
--slave /usr/bin/jstat jstat /usr/lib64/jdk_Oracle/bin/jstat \
--slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/lib64/jdk_Oracle/man/man1/jstat.1.gz \
--slave /usr/bin/jstatd jstatd /usr/lib64/jdk_Oracle/bin/jstatd \
--slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/lib64/jdk_Oracle/man/man1/jstatd.1.gz \
--slave /usr/bin/native2ascii native2ascii /usr/lib64/jdk_Oracle/bin/native2ascii \
--slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/lib64/jdk_Oracle/man/man1/native2ascii.1.gz \
--slave /usr/bin/pack200 pack200 /usr/lib64/jdk_Oracle/bin/pack200 \
--slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/lib64/jdk_Oracle/man/man1/pack200.1.gz \
--slave /usr/bin/rmic rmic /usr/lib64/jdk_Oracle/bin/rmic \
--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/lib64/jdk_Oracle/man/man1/rmic.1.gz \
--slave /usr/bin/schemagen schemagen /usr/lib64/jdk_Oracle/bin/schemagen \
--slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/lib64/jdk_Oracle/man/man1/schemagen.1.gz \
--slave /usr/bin/serialver serialver /usr/lib64/jdk_Oracle/bin/serialver \
--slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/lib64/jdk_Oracle/man/man1/serialver.1.gz \
--slave /usr/bin/unpack200 unpack200 /usr/lib64/jdk_Oracle/bin/unpack200 \
--slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/lib64/jdk_Oracle/man/man1/unpack200.1.gz \
--slave /usr/bin/wsgen wsgen /usr/lib64/jdk_Oracle/bin/wsgen \
--slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/lib64/jdk_Oracle/man/man1/wsgen.1.gz \
--slave /usr/bin/wsimport wsimport /usr/lib64/jdk_Oracle/bin/wsimport \
--slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/lib64/jdk_Oracle/man/man1/wsimport.1.gz \
--slave /usr/bin/xjc xjc /usr/lib64/jdk_Oracle/bin/xjc \
--slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/lib64/jdk_Oracle/man/man1/xjc.1.gz

Web browser plug-in

Linux x86 (32-bit architecture), openSUSE versions prior to Leap 15.0
sudo /usr/sbin/update-alternatives --install /usr/lib/browser-plugins/javaplugin.so javaplugin /usr/lib/jdk_Oracle/jre/lib/i386/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib/jdk_Oracle/jre/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib/jdk_Oracle/man/man1/javaws.1
Linux x86_64 (64-bit architecture), openSUSE versions prior to Leap 15.0

For openSUSE 64-bit just use, instead:

sudo /usr/sbin/update-alternatives --install /usr/lib64/browser-plugins/javaplugin.so javaplugin /usr/lib64/jdk_Oracle/jre/lib/amd64/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib64/jdk_Oracle/jre/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib64/jdk_Oracle/man/man1/javaws.1
Icon-warning.png
Warning: Commands above fail since Leap 15.0 with
update-alternatives: error: alternative javaws can't be slave of javaplugin: it is a slave of libjavaplugin.so.x86_64

so use the commands below instead:

Linux x86 (32-bit architecture), openSUSE versions since Leap 15.0
sudo /usr/sbin/update-alternatives --install /usr/lib/browser-plugins/libjavaplugin.so libjavaplugin.so /usr/lib/jdk_Oracle/jre/lib/i386/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib/jdk_Oracle/jre/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib/jdk_Oracle/man/man1/javaws.1
Linux x86_64 (64-bit architecture), openSUSE versions since Leap 15.0

For openSUSE 64-bit just use, instead:

sudo /usr/sbin/update-alternatives --install /usr/lib64/browser-plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/lib64/jdk_Oracle/jre/lib/amd64/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib64/jdk_Oracle/jre/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib64/jdk_Oracle/man/man1/javaws.1</div

Making Oracle Java default

You will have to select the appropriate number after running: (This also can be used to switch between different implementations of java).

Java application launcher

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

Java compiler

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

Web browser plug-in, openSUSE versions prior to Leap 15.0

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

Web browser plug-in, Linux x86 (32-bit architecture), openSUSE versions since Leap 15.0

sudo /usr/sbin/update-alternatives --config libjavaplugin.so

Web browser plug-in, Linux x86_64 (64-bit architecture), openSUSE versions since Leap 15.0

sudo /usr/sbin/update-alternatives --config libjavaplugin.so.x86_64

Setting options specific for version of installed Java (option)

You can even set Oracle Java as an alternative for JDK (and JRE) environments, just for a particular version of Java, in this case 1.7.0; the changes will be applied with usual update-alternatives.

Java application launcher

Linux x86 (32-bit architecture)
sudo /usr/sbin/update-alternatives --install /usr/lib/jvm/jre-1.7.0 jre_1.7.0 /usr/lib/jdk_Oracle/jre 3 --slave /usr/lib/jvm-exports/jre-1.7.0 jre_1.7.0_exports /usr/lib/jvm-exports/jdk_Oracle
Linux x86_64 (64-bit architecture)
sudo /usr/sbin/update-alternatives --install /usr/lib64/jvm/jre-1.7.0 jre_1.7.0 /usr/lib64/jdk_Oracle/jre 3 --slave /usr/lib64/jvm-exports/jre-1.7.0 jre_1.7.0_exports /usr/lib64/jvm-exports/jdk_Oracle

To select your alternative (all architectures):

sudo /usr/sbin/update-alternatives --config jre_1.7.0

Java compiler

Linux x86 (32-bit architecture)
sudo /usr/sbin/update-alternatives --install /usr/lib/jvm/java-1.7.0 java_sdk_1.7.0 /usr/lib/jdk_Oracle 3 --slave /usr/lib/jvm-exports/java-1.7.0 java_sdk_1.7.0_exports /usr/lib/jvm-exports/jdk_Oracle
Linux x86_64 (64-bit architecture)
sudo /usr/sbin/update-alternatives --install /usr/lib64/jvm/java-1.7.0 java_sdk_1.7.0 /usr/lib64/jdk_Oracle 3 --slave /usr/lib64/jvm-exports/java-1.7.0 java_sdk_1.7.0_exports /usr/lib64/jvm-exports/jdk_Oracle

To select your alternative (all architectures):

sudo /usr/sbin/update-alternatives --config java_sdk_1.7.0

Updating Oracle Java

Updating Oracle Java is really easy thanks to the /usr/lib/jdk_Oracle (/usr/lib64/jdk_Oracle on x86_64) link that was created above.

Linux x86 (32-bit architecture)

1) Repeat the procedure up to moving the jdk1.X.X_XX to /usr/lib

2) Then just change the symbolic link /usr/lib/jdk_Oracle to point to the new Java SE
sudo ln -s -f -T /usr/lib/jdk1.X.Y_YY/ /usr/lib/jdk_Oracle
Linux x86_64 (64-bit architecture)

1) Repeat the procedure up to moving the jdk1.X.X_XX to /usr/lib64

2) Then just change the symbolic link /usr/lib64/jdk_Oracle to point to the new Java SE
sudo ln -s -f -T /usr/lib64/jdk1.X.Y_YY/ /usr/lib64/jdk_Oracle

3) Finally re-compress the man files as described above (all architectures).

Adding Java Control Panel

Once you set Oracle Java as your default jvm, you might want to be able to run /usr/lib/jdk_Oracle/bin/jcontrol (replace lib with lib64 if you are running a 64-bit system), e.g. the application providing your Java Control Panel, directly from the applications menu for your favorite Desktop Environment.

In order to add item "Java - Java Control Panel" to the application menu, you will need to create a couple of symbolic links, which you could delete with sudo rm /path/to/your/symlink, should you want to remove Oracle Java. You can create those symbolic links using following commands, taking care that /usr/lib must be replaced with /usr/lib64 if you own a 64-bit system:

Linux x86 (32-bit architecture)
sudo ln -s /usr/lib/jdk_Oracle/jre/bin/jcontrol /usr/bin/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/applications/sun_java.desktop /usr/share/applications
Linux x86_64 (64-bit architecture)
sudo ln -s /usr/lib64/jdk_Oracle/jre/bin/jcontrol /usr/bin/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/applications/sun_java.desktop /usr/share/applications

Procedure with runtime environment only (JRE)

For Java Runtime Environment only.

Icon-warning.png
Warning: From here to the end of this section, for any sub-section (Updating Oracle Java (JRE) included), if your system has a 64-bit architecture, any occurrence of /usr/lib must be replaced with /usr/lib64. Please follow the appropriate subsections for your system architecture, when you are inserting the commands.

Install Oracle Java SE (JRE)

  • Download Oracle Java SE Runtime Environment (JRE) from the Oracle Java website. Save it to an easy to remember directory (eg. /tmp)
Download a suitable version for your system architecture. E.g.: with Oracle Java version 1.7.0_7:
Linux x86 (32-bit architecture)
jre-7u7-linux-i586.tar.gz
Linux x64 (64-bit architecture)
jre-7u7-linux-x64.tar.gz
  • Open a terminal and run:
    cd /path/to/downloaded/java
  • Decompress it with (as root, just to be sure):
    sudo tar -xzf ./jre-7uX-linux-XX.tar.gz
  • Fix permissions for the expanded directory and its content:
    sudo chown -R root:root jre1.X.X_XX/
Linux x86 (32-bit architecture)
  • Open JDK is installed by default in /usr/lib, so let's move Oracle Java to /usr/lib as well:
    sudo mv ./jre1.X.X_XX/ /usr/lib/
  • Create a symbolic link to /usr/lib/jdk1.X.X_XX/ (this will be important later for updating):
    sudo ln -s -T /usr/lib/jre1.X.X_XX/ /usr/lib/jdk_Oracle
Linux x86_64 (64-bit architecture)
  • Open JDK is installed by default in /usr/lib64, so let's move Oracle Java to /usr/lib64 as well:
    sudo mv ./jre1.X.X_XX/ /usr/lib64/
  • Create a symbolic link to /usr/lib64/jdk1.X.X_XX/ (this will be important later for updating):
    sudo ln -s -T /usr/lib64/jre1.X.X_XX/ /usr/lib64/jdk_Oracle

Inform the system (JRE)

Java application launcher

  • Compress the man files involved in your installation:
Linux x86 (32-bit architecture)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/java.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/policytool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmid.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmiregistry.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/servertool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/tnameserv.1)
Linux x86_64 (64-bit architecture)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/java.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/policytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmid.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/servertool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/tnameserv.1)
  • Prepare the directory for jvm-exports (specific for version 1.7.0):
Linux x86 (32-bit architecture)
  1. sudo mkdir /usr/lib/jvm-exports/jdk_Oracle
    cd /usr/lib/jvm-exports/jdk_Oracle
    sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jaas-1.7.0_Orac.jar
    sudo ln -s jaas-1.7.0_Orac.jar jaas-1.7.0.jar
    sudo ln -s jaas-1.7.0_Orac.jar jaas.jar
    sudo ln -s /usr/lib/jdk_Oracle/lib/jce.jar jce-1.7.0_Orac.jar
    sudo ln -s jce-1.7.0_Orac.jar jce-1.7.0.jar
    sudo ln -s jce-1.7.0_Orac.jar jce.jar
    sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jdbc-stdext-1.7.0_Orac.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-1.7.0.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-3.0.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext.jar
    sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jndi-1.7.0_Orac.jar
    sudo ln -s jndi-1.7.0_Orac.jar jndi-1.7.0.jar
    sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jndi-cos-1.7.0_Orac.jar
    sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos-1.7.0.jar
    sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos.jar
    sudo ln -s jndi-1.7.0_Orac.jar jndi.jar
    sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jndi-ldap-1.7.0_Orac.jar
    sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap-1.7.0.jar
    sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap.jar
    sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jndi-rmi-1.7.0_Orac.jar
    sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi-1.7.0.jar
    sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi.jar
    sudo ln -s /usr/lib/jdk_Oracle/lib/jsse.jar jsse-1.7.0_Orac.jar
    sudo ln -s jsse-1.7.0_Orac.jar jsse-1.7.0.jar
    sudo ln -s jsse-1.7.0_Orac.jar jsse.jar
    sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar sasl-1.7.0_Orac.jar
    sudo ln -s sasl-1.7.0_Orac.jar sasl-1.7.0.jar
    sudo ln -s sasl-1.7.0_Orac.jar sasl.jar
  2. sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib/jvm/jre jre /usr/lib/jdk_Oracle --slave /usr/lib/jvm-exports/jre jre_exports /usr/lib/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib/jdk_Oracle/man/man1/tnameserv.1.gz
Linux x86_64 (64-bit architecture)
  1. sudo mkdir /usr/lib64/jvm-exports/jdk_Oracle
    cd /usr/lib64/jvm-exports/jdk_Oracle
    sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jaas-1.7.0_Orac.jar
    sudo ln -s jaas-1.7.0_Orac.jar jaas-1.7.0.jar
    sudo ln -s jaas-1.7.0_Orac.jar jaas.jar
    sudo ln -s /usr/lib64/jdk_Oracle/lib/jce.jar jce-1.7.0_Orac.jar
    sudo ln -s jce-1.7.0_Orac.jar jce-1.7.0.jar
    sudo ln -s jce-1.7.0_Orac.jar jce.jar
    sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jdbc-stdext-1.7.0_Orac.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-1.7.0.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-3.0.jar
    sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext.jar
    sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jndi-1.7.0_Orac.jar
    sudo ln -s jndi-1.7.0_Orac.jar jndi-1.7.0.jar
    sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jndi-cos-1.7.0_Orac.jar
    sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos-1.7.0.jar
    sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos.jar
    sudo ln -s jndi-1.7.0_Orac.jar jndi.jar
    sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jndi-ldap-1.7.0_Orac.jar
    sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap-1.7.0.jar
    sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap.jar
    sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jndi-rmi-1.7.0_Orac.jar
    sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi-1.7.0.jar
    sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi.jar
    sudo ln -s /usr/lib64/jdk_Oracle/lib/jsse.jar jsse-1.7.0_Orac.jar
    sudo ln -s jsse-1.7.0_Orac.jar jsse-1.7.0.jar
    sudo ln -s jsse-1.7.0_Orac.jar jsse.jar
    sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar sasl-1.7.0_Orac.jar
    sudo ln -s sasl-1.7.0_Orac.jar sasl-1.7.0.jar
    sudo ln -s sasl-1.7.0_Orac.jar sasl.jar
  2. sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib64/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib64/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib64/jvm/jre jre /usr/lib64/jdk_Oracle --slave /usr/lib64/jvm-exports/jre jre_exports /usr/lib64/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib64/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib64/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib64/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib64/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib64/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib64/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib64/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib64/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib64/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib64/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib64/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib64/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib64/jdk_Oracle/man/man1/tnameserv.1.gz

Web browser plug-in

Linux x86 (32-bit architecture)
sudo /usr/sbin/update-alternatives --install /usr/lib/browser-plugins/javaplugin.so javaplugin /usr/lib/jdk_Oracle/lib/i386/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib/jdk_Oracle/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib/jdk_Oracle/man/man1/javaws.1
Linux x86_64 (64-bit architecture)
For openSUSE 64-bit just use, instead:
sudo /usr/sbin/update-alternatives --install /usr/lib64/browser-plugins/javaplugin.so javaplugin /usr/lib64/jdk_Oracle/lib/amd64/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib64/jdk_Oracle/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib64/jdk_Oracle/man/man1/javaws.1
Icon-warning.png
Warning: Commands above fail since Leap 15.0 with
update-alternatives: error: alternative javaws can't be slave of javaplugin: it is a slave of libjavaplugin.so.x86_64

so use the commands below instead:

Linux x86 (32-bit architecture), openSUSE versions since Leap 15.0
sudo /usr/sbin/update-alternatives --install /usr/lib/browser-plugins/libjavaplugin.so libjavaplugin.so /usr/lib/jdk_Oracle/jre/lib/i386/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib/jdk_Oracle/jre/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib/jdk_Oracle/man/man1/javaws.1
Linux x86_64 (64-bit architecture), openSUSE versions since Leap 15.0
For openSUSE 64-bit just use, instead:
sudo /usr/sbin/update-alternatives --install /usr/lib64/browser-plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/lib64/jdk_Oracle/jre/lib/amd64/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib64/jdk_Oracle/jre/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib64/jdk_Oracle/man/man1/javaws.1

Making Oracle Java default (JRE)

You will have to select the appropriate number after running: (This also can be used to switch between different implementations of java).

Java application launcher

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

Web browser plug-in, openSUSE versions prior to Leap 15.0

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

Web browser plug-in, Linux x86 (32-bit architecture), openSUSE versions since Leap 15.0

sudo /usr/sbin/update-alternatives --config libjavaplugin.so

Web browser plug-in, Linux x86_64 (64-bit architecture), openSUSE versions since Leap 15.0

sudo /usr/sbin/update-alternatives --config libjavaplugin.so.x86_64

Setting options specific for version of installed Java JRE (option)

You can even set Oracle Java as an alternative for the JRE environment, just for a particular version of Java, in this case 1.7.0; the changes will be applied with usual update-alternatives.

Java application launcher

Linux x86 (32-bit architecture)
sudo /usr/sbin/update-alternatives --install /usr/lib/jvm/jre-1.7.0 jre_1.7.0 /usr/lib/jdk_Oracle 3 --slave /usr/lib/jvm-exports/jre-1.7.0 jre_1.7.0_exports /usr/lib/jvm-exports/jdk_Oracle
Linux x86_64 (64-bit architecture)
sudo /usr/sbin/update-alternatives --install /usr/lib64/jvm/jre-1.7.0 jre_1.7.0 /usr/lib64/jdk_Oracle 3 --slave /usr/lib64/jvm-exports/jre-1.7.0 jre_1.7.0_exports /usr/lib64/jvm-exports/jdk_Oracle

To select your alternative (all arch):

sudo /usr/sbin/update-alternatives --config jre_1.7.0

Updating Oracle Java (JRE)

Updating Oracle Java is really easy thanks to the /usr/lib/jdk_Oracle (/usr/lib64/jdk_Oracle on x86_64) link that was created above.

Linux x86 (32-bit architecture)

1) Repeat the procedure up to moving the jre1.X.X_XX to /usr/lib

2) Then just change the symbolic link /usr/lib/jdk_Oracle to point to the new Java SE
sudo ln -s -f -T /usr/lib/jre1.X.Y_YY/ /usr/lib/jdk_Oracle
Linux x86_64 (64-bit architecture)

1) Repeat the procedure up to moving the jre1.X.X_XX to /usr/lib64

2) Then just change the symbolic link /usr/lib64/jdk_Oracle to point to the new Java SE
sudo ln -s -f -T /usr/lib64/jre1.X.Y_YY/ /usr/lib64/jdk_Oracle

3) Finally re-compress the man files as described above (all architectures).

Adding Java Control Panel (JRE)

Once you set Oracle Java as your default jvm, you might want to be able to run /usr/lib/jdk_Oracle/bin/jcontrol (replace lib with lib64 if you are running a 64-bit system), e.g. the application providing your Java Control Panel, directly from the applications menu for your favourite Desktop Environment.

In order to add item "Java - Java Control Panel" to the application menu, you will need to create a couple of symbolic links, which you could delete with sudo rm /path/to/your/symlink, should you want to remove Oracle Java. You can create those symbolic links using following commands, taking care that /usr/lib must be replaced with /usr/lib64 if you own a 64-bit system:

Linux x86 (32-bit architecture)
sudo ln -s /usr/lib/jdk_Oracle/bin/jcontrol /usr/bin/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/applications/sun_java.desktop /usr/share/applications/
Linux x86_64 (64-bit architecture)
sudo ln -s /usr/lib64/jdk_Oracle/bin/jcontrol /usr/bin/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/applications/sun_java.desktop /usr/share/applications/

Related documentation

man update-alternatives
less /var/lib/rpm/alternatives/java
less /var/lib/rpm/alternatives/javac
less /var/lib/rpm/alternatives/javaplugin

External links

Other Java related topics