SUSE Support

Here When You Need Us

How to manually install Oracle Java into SLED 11 SP1/2

This document (7008541) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Desktop 11 Service Pack 1
SUSE Linux Enterprise Desktop 11 Service Pack 2
Oracle Java
Mozilla Firefox browser

Situation

Due to changed licenses, SUSE is no longer able to update Oracle/Sun Java packages in SLED (java-1_6_0-sun). This will leave systems vulnerable, because there are obviously many security and critical bugs fixed in each update.

This enforced SUSE to use openjdk6 (java-1_6_0-openjdk) and icedtea-web by default. Those packages are intended to be compatible with Oracle Java, however there can be some incompatibilities especially in Java plugin and Java webstart.

Resolution

1.) Remove installed software (optional)

This step is not strictly required, but it can make your system cleaner without unwanted and possibly vulnerable software installed. However this TID will show how to configure a system to be able use both version in parallel.

Use YaST -> Software -> Software Management and remove all java-1_6_0-sun, java-1_6_0-openjdk and icedtea-web packages you will find. You might consider using lock/taboo to prevent them beeing installed in future again.

2.) Download Oracle Java

 * Check if you have i586 or x86_64 version of Mozilla Firefox (this can be different from the architecture of the system). The easiest way is to open a console and type

   rpm -q --queryformat '%{arch}\n' MozillaFirefox

   If x86_64 appears, use the version marked as Linux x64 RPM.

 * Visit http://java.com/ and click on Free Java Download

2a) Install the RPM package

 * Select the RPM appropriate for your Firefox Firefox browser architecture and download it
 * As a root type:

   rpm -Uhv <downloaded-file>

   for example

   rpm -ihv jre-7u16-linux-i586.rpm

 * In case you need to update this version at a later point in time, download the latest version and run the following command:

   rpm -Uhv jre-7u17-linux-i586.rpm
   
2b) Install from tar.gz

 * Alternatively you might consider downloading the tar.gz file. In this case running "tar xvzf <downloaded-file>" will unpack Java into jre1.7.0_${VERSION} directory. You can then copy it to the final destination - the most preferred location is /usr/java with a /usr/java/latest symbolic link. If you will decide use different path, then you have change paths in commands in sections 3.) and 4.)

   mkdir -r /usr/java
   cp -r jre1.7.0_17 /usr/java
   ln -sf /usr/java/jre1.7.0_17 /usr/java/latest

 * You can upgrade your java by removing of the current directory and latest symlink, copy new content and restore the latest symlink again:
 
   rm -rf /usr/java/jre1.7.0_17 /usr/java/latest
   cp -r jre1.7.0_17 /usr/share/java
   ln -sf /usr/java/jre1.7.0_17 /usr/java/latest

3.) Integrate java plugin with Mozilla Firefox

Oracle rpm installs Java to /usr/java/jre1.7.0_${VERSION}, which is symlinked to /usr/java/latest. To have a similar level of integration into SUSE Linux systems as distribution packages please perform the following commands as root (you have to do it only once).

To make the java plugin and java webstart working

# on i586

/usr/sbin/update-alternatives --install \
    /usr/lib/browser-plugins/javaplugin.so javaplugin\
    /usr/java/latest/lib/i386/libnpjp2.so 20000 \
    --slave /usr/bin/javaws javaws /usr/java/latest/bin/javaws

# on x86_64

/usr/sbin/update-alternatives --install \
/usr/lib64/browser-plugins/javaplugin.so javaplugin\
/usr/java/latest/lib/amd64/libnpjp2.so 20000 \
--slave /usr/bin/javaws javaws /usr/java/latest/bin/javaws

You might check the output of "/usr/sbin/update-alternatives --display javaplugin" command. If everything is configured properly, then the output says that the link currently points to /usr/java/latest/.../libnpjp2.so. If that is not correct, you can restore link by the following command:

/usr/sbin/update-alternatives --auto javaplugin

Then restart Firefox and type about:plugins into address bar. There will be following text:

  Java(TM) Plug-in 1.7.0_17
  File: libnpjp2.so
  Version:
  The next generation Java plug-in for Mozilla browsers

You can visit java.com/en/download/testjava.jsp to test if that works. If succeeded, you will se a test:

Your Java is working
Latest Java installed

4.) Integrate rest of runtime with a system

To make command java working, you have to type:

/usr/sbin/update-alternatives --install \
/usr/bin/java java /usr/java/latest/bin/java 20000 \
--slave /usr/bin/keytool keytool /usr/java/latest/bin/keytool \
--slave /usr/bin/orbd orbd /usr/java/latest/bin/orbd \
--slave /usr/bin/pack200 pack200 /usr/java/latest/bin/pack200 \
--slave /usr/bin/policytool policytool /usr/java/latest/bin/policytool \
--slave /usr/bin/rmid rmid /usr/java/latest/bin/rmid \
--slave /usr/bin/rmiregistry rmiregistry /usr/java/latest/bin/rmiregistry \
--slave /usr/bin/tnameserv tnameserv /usr/java/latest/bin/tnameserv \
--slave /usr/bin/unpack200 unpack200 /usr/java/latest/bin/unpack200

Then check output of "/usr/sbin/update-alternatives --display java" and fix problems via

/usr/sbin/update-alternatives --auto java

As some scripts expects JAVA_HOME variable, you can add the following the following lines to the file /etc/profile.d/zzz-oracle-java.sh:

export JAVA_HOME=/usr/java/latest
export JAVA_ROOT=/usr/java/latest
export JAVA_BINDIR=/usr/java/latest/bin
export JRE_HOME=/usr/java/latest

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7008541
  • Creation Date: 31-May-2012
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Desktop
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.