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:
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.
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