How to install Oracle Java on openSUSE 12.1

Due to a Oracle license change, openSUSE 12.1 no longer includes Oracle Java (formerly known as Sun Java), only openJDK.  While this should mostly work, it may be that you need the “original” Java for some applications that are picky about it.  This article covers:

  • installing Oracle Java JRE or JDK
  • configuring the java plugin in Firefox
  • binfmt_misc (so you can run java executables by calling them directly on the command line)

Installing Oracle Java JRE or JDK

Get version 7 or 6 here: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Choose the rpm binary that’s suitable for your computer’s architecture (x86 32 bit or x86_64; look in this file to be sure: /etc/SuSE-release)

Open a terminal window (Konsole or Gnome Terminal), become root and install with this command:

sh jdk-6u29-linux-x64-rpm.bin

This will unpack the .rpms from the .bin file and install them.  Verify by running:

java -version
which java

Then you can remove the sun*.rpm files that were created in the current directory.

Configuring the Java plugin for Firefox

As root, go to the browser plugin directory /usr/lib64/browser-plugins (or /usr/lib/browser-plugins for 32 bit).  Then create a symlink to the libnpjp2.so file.  The command below will find the file and create the link to it.  It assumes you have only one version of Oracle Java installed.  If you have more, you have to run the find command first, then create the symlink after you see the results.

cd /usr/lib64/browser-plugins
ln -s $(find /usr/java -name libnpjp2.so)

Verify that it works by starting Firefox and typing “about:plugins” in the Location Bar.  There should be a Java Plugin section in the page.

binfmt_misc

This is a bit optional, being rarely used, but you might like it.  It allows you to run java programs by calling them directly on the command line.  That is, instead of running “java -jar some.jar”, you could run “./some.jar”.  Not a big deal.  However, you may still want to perform at least the first step below because Oracle Java installs an init script called jexec that is not conforming to LSB and you get this kind of errors when enabling other services:

insserv: Script jexec is broken: incomplete LSB comment.
insserv: missing `Required-Stop:'  entry: please add even if empty.

As root, disable this service and then, erase the script

chkconfig --del jexec
rm -f /etc/init.d/jexec

Then install a proper script from SUSE, if you need the functionality:

zypper install java-binfmt-misc
About these ads

4 thoughts on “How to install Oracle Java on openSUSE 12.1

  1. Thanks for the info, but how do this rpm’s play with update-alternatives and if you have multiple java versions installed in your system? If I have java 1.6 installed and install Oracle 1.7 it will damage the installation. What can one do in this case?

  2. I think it doesn’t play nice with alternatives, I think it just ignores them. It’s kind of a generic RPM made by Oracle and they don’t bother with adapting their software for specific distributions. I have always removed all other Java (like OpenJDK) before installing this. If you meant having both versions 6 and 7 of Oracle Java, they reside in /usr/java.. they create there a couple of symlinks called “latest” and “default”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s