Install Oracle JDK on openSUSE
I preferred Oracle’s JDK over OpenJDK for my openSUSE development setup. Here’s how I installed and configured Oracle JDK 8.
The examples below use JDK 8u5. If you install a different release, adjust the package filenames and installation paths accordingly.
-
Download the JDK.
Download the RPM package for your architecture from Oracle’s JDK 8 archive. I used the Linux x64 package for 64-bit openSUSE. For a 32-bit system, choose the Linux x86 (i586) RPM.
-
Install the RPM.
Open a terminal, become root, and change to the directory where you downloaded the RPM package.
For a 64-bit system, run:
rpm -i jdk-8u5-linux-x64.rpmFor a 32-bit system, run:
rpm -i jdk-8u5-linux-i586.rpm -
Make Oracle JDK the default.
While still working as root, register the JDK tools with
update-alternatives:update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_05/bin/java 1551 update-alternatives --install /usr/bin/javadoc javadoc /usr/java/jdk1.8.0_05/bin/javadoc 1551 update-alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_05/bin/jar 1551 update-alternatives --install /usr/bin/javap javap /usr/java/jdk1.8.0_05/bin/javap 1551 update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_05/bin/javac 1551 update-alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_05/bin/javaws 1551 update-alternatives --install /usr/bin/javah javah /usr/java/jdk1.8.0_05/bin/javah 1551 update-alternatives --install /usr/bin/jarsigner jarsigner /usr/java/jdk1.8.0_05/bin/jarsigner 1551Select the Oracle installation for each registered tool using
update-alternatives --config. For example, for Java and its compiler:update-alternatives --config java update-alternatives --config javacRepeat this for the other tools listed above.
-
Set the JAVA_HOME environment variable.
Type
exitto leave the root shell and return to your regular user account. Open~/.bashrcin your preferred text editor and add:export JAVA_HOME=/usr/java/jdk1.8.0_05Save the file, then load the updated settings:
source ~/.bashrc -
Verify the installation.
Check the Java runtime and compiler versions:
java -version javac -versionBoth should report the version you installed. For the JDK 8u5 example,
java -versionshould includejava version "1.8.0_05".
Related Posts
2011-07-20
2011-07-12