Installing Oracle Java on SLES 11.2

There appears to be several items that need to be performed to properly install Oracle Java.

Where to install
(I read several conflicting places Oracle Java should be installed)
The IBM version that comes as the installed Java is installed at:
IBM Java has:

l /usr/lib64/jvm-private/java-1_6_0-ibm Which only has: drwxr-xr-x 3 root root 4096 Mar 12 10:45 jce/

Appears the binaries are:

l /usr/lib64/jvm/jre-1.6.0-ibm/ drwxr-xr-x 4 root root 4096 Mar 21 11:18 bin/ drwxr-xr-x 2 root root 4096 Mar 21 11:18 javaws/ drwxr-xr-x 18 root root 4096 Mar 21 11:18 lib/ -rwxr-xr-x 1 root root 1191000 Mar 12 10:46 .qa_filelist.x86_64* drwxr-xr-x 2 root root 4096 Mar 12 10:46 .systemPrefs/

When you install Oracle Java from the Binary, it installs to:

l /usr/java/ drwxr-xr-x 8 root root 4096 Mar 22 12:38 jdk1.7.0_17/ drwxr-xr-x 6 root root 4096 Mar 21 11:10 jre1.7.0_17/
(I installed both the JDK and JRE and do realizes I only need the JDK)

I also found there are pointers to is here: (All empty directories so I think useless! whihc were apparenlty form time stamps in the original install)

l /usr/lib64/ |grep java drwxr-xr-x 2 root root 4096 Feb 20 2009 java/ drwxr-xr-x 2 root root 4096 Feb 20 2009 java-1.4.0/ drwxr-xr-x 2 root root 4096 Feb 20 2009 java-1.4.1/ drwxr-xr-x 2 root root 4096 Feb 20 2009 java-1.4.2/ drwxr-xr-x 2 root root 4096 Feb 20 2009 java-1.5.0/ drwxr-xr-x 2 root root 4096 Feb 20 2009 java-1.6.0/ drwxr-xr-x 2 root root 4096 Feb 20 2009 java-1.7.0/ drwxr-xr-x 2 root root 4096 Feb 20 2009 java-ext/

The alternatives MESS!
I understand and appreciate the idea of alternatives however it is a mess.
The documentation is non-existent. As a simple example, which is the higer priority: 1610 or 60? (Would you rather be first or 1610?)

Anyhow, here is what, after reading a lot of conflicting entries:
Instaled the Oracle Java using:

zypper in jre-7u7-linux-x64.rpm -y

Set a softlink as:

ln -s /usr/java/default/ /usr/java/jdk1.7.0_17/ ln -s /usr/java/latest/ /usr/java/jdk1.7.0_17/
Used this line:

update-alternatives --install java java /usr/java/latest/bin/java 60 --slave jre jre /usr/java/latest --slave rmiregistry rmiregistry /usr/java/latest/bin/rmiregistry --slave tnameserv tnameserv /usr/java/latest/bin/tnameserv --slave rmid rmid /usr/java/latest/bin/rmid --slave ControlPanel ControlPanel /usr/java/latest/bin/ControlPanel --slave policytool policytool /usr/java/latest/bin/policytool --slave keytool keytool /usr/java/latest/bin/keytool --slave javaws javaws /usr/java/latest/bin/javaws

Ran this: (Set default to “2”):

[CODE]update-alternatives --config java

There are 2 alternatives which provide `java’.

Selection Alternative

  •    1    /usr/lib64/jvm/jre-1.6.0-ibm/bin/java
    
  •     2    /usr/java/latest/bin/java
    

Press enter to keep the default[*], or type selection number: [/CODE]

Yet when I run:

update-alternatives --display java java - status is manual. link currently points to /usr/java/latest/bin/java /usr/lib64/jvm/jre-1.6.0-ibm/bin/java - priority 1610 slave rmiregistry: /usr/lib64/jvm/jre-1.6.0-ibm/bin/rmiregistry slave tnameserv: /usr/lib64/jvm/jre-1.6.0-ibm/bin/tnameserv slave rmid: /usr/lib64/jvm/jre-1.6.0-ibm/bin/rmid slave jre_exports: /usr/lib64/jvm-exports/jre-1.6.0-ibm slave ControlPanel: /usr/lib64/jvm/jre-1.6.0-ibm/bin/ControlPanel slave policytool: /usr/lib64/jvm/jre-1.6.0-ibm/bin/policytool slave keytool: /usr/lib64/jvm/jre-1.6.0-ibm/bin/keytool slave jre: /usr/lib64/jvm/jre-1.6.0-ibm slave javaws: /usr/lib64/jvm/jre-1.6.0-ibm/bin/javaws /usr/java/latest/bin/java - priority 60 slave rmiregistry: /usr/java/latest/bin/rmiregistry slave tnameserv: /usr/java/latest/bin/tnameserv slave rmid: /usr/java/latest/bin/rmid slave ControlPanel: /usr/java/latest/bin/ControlPanel slave policytool: /usr/java/latest/bin/policytool slave keytool: /usr/java/latest/bin/keytool slave jre: /usr/java/latest slave javaws: /usr/java/latest/bin/javaws Current `best' version is /usr/lib64/jvm/jre-1.6.0-ibm/bin/java.

So I apparently set the priority to a low instead of a high number.
How do I change it?

Environment Variables
Then there are the environment variables that need set.
I read some where that you should do this: (which seems to work, but I am not sure why)

/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 export JDK_HOME=/usr/java/jdk1.7.0_17

PATH
I did notice that when I execute:
which java
which: no java in (/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin)

Which I am okay with that as I can controll all my apps form the environement variables; but I am sure some people would not like this.

So I end up with some questions:
[LIST]
[]Is this the right method?
[
]Where should Java be installed?
[]How can I change the priority of the IBM JDK to a lower number?
[
]What is the /etc/alternatives folder supposed to be user for?
[*]What is the /usr/lib64/java… folders supposed to be user for?
[/LIST]

Any comments or suggestions are appreciated.

[QUOTE=jwilleke;12617]There appears to be several items that need to be performed to properly install Oracle Java.

Which I am okay with that as I can controll all my apps form the environement variables; but I am sure some people would not like this.

So I end up with some questions:
[LIST]
[]Is this the right method?
[
]Where should Java be installed?
[]How can I change the priority of the IBM JDK to a lower number?
[
]What is the /etc/alternatives folder supposed to be user for?
[*]What is the /usr/lib64/java… folders supposed to be user for?
[/LIST]

Any comments or suggestions are appreciated.[/QUOTE]

As far as it the right method, it depends on where you got your documentation.
Was there a specific application that specifically required Oracle java? If not, why not use the default zypper installs?

server:~ # zypper search java
Loading repository data…
Reading installed packages…

S | Name | Summary | Type
–±-----------------------±---------------------------------------±----------
| ant-javadoc | Javadoc for ant | package
| ant-javamail | Optional javamail tasks for ant | package
| gcc43-java | The GNU Java Compiler | package
| java-1_6_0-ibm-fonts | Java™ 2 Runtime Environment | package
| java-1_6_0-ibm-jdbc | JDBC/ODBC bridge driver for java-1.6-> | package
| java-1_7_0-ibm | Java™ 6 Runtime Environment | srcpackage
i| java-1_7_0-ibm | Java™ 6 Runtime Environment | package
| java-1_7_0-ibm-devel | Java™ 6 SDK, Standard Edition | package
| java-1_7_0-ibm-jdbc | JDBC/ODBC bridge driver for java-1.6-> | package
| monodevelop-java | Monodevelop Java Addin | package
| sdk_java | SDK: Java Development | pattern
| slessp2-java-1_6_0-ibm | Security update for Java | patch
i| slessp2-java-1_7_0-ibm | Security update for Java | patch

server:~ # rpm -qa --list java-1_7_0-ibm | more
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0
/usr/lib64/jvm-exports/jre-1.7.0-ibm
/usr/lib64/jvm/jre-1.7.0-ibm

I’m not exactly sure what you mean by changing the priority to a lower number, but commonly it’s just whichever is in your path PATH first
export PATH=/path/to/preferred/java/version/bin/java;/bin;/sbin…

It’s not uncommon to have many versions of java installed on some servers. Typically different applications require different versions.
Adjust your environmental variables accordingly (i.e. JAVA_HOME= and PATH= )

/etc/alternatives appears to be just a directory of symbolic links, I’m not exactly sure what the advantage of having this is,
but if nothing else, it’s a quick way to see all the paths… to say… all the versions of java. Also You use the alternatives link in your PATH.

server:/etc/alternatives # ls -l | grep jvm
lrwxrwxrwx 1 root root 45 Mar 22 13:23 ControlPanel → /usr/lib64/jvm/jre-1.7.0-ibm/bin/ControlPanel
lrwxrwxrwx 1 root root 37 Mar 22 13:23 java → /usr/lib64/jvm/jre-1.7.0-ibm/bin/java
lrwxrwxrwx 1 root root 62 Mar 22 13:23 javaplugin → /usr/lib64/jvm/java-1.7.0-ibm-1.7.0/jre/lib/amd64//libnpjp2.so
lrwxrwxrwx 1 root root 39 Mar 22 13:23 javaws → /usr/lib64/jvm/jre-1.7.0-ibm/bin/javaws
lrwxrwxrwx 1 root root 66 Mar 22 13:23 jce_1.7.0_ibm_local_policy → /usr/lib64/jvm-private/java-1.7.0-ibm/jce/vanilla/local_policy.jar
lrwxrwxrwx 1 root root 70 Mar 22 13:23 jce_1.7.0_ibm_us_export_policy → /usr/lib64/jvm-private/java-1.7.0-ibm/jce/vanilla/US_export_policy.jar
lrwxrwxrwx 1 root root 28 Mar 22 13:23 jre → /usr/lib64/jvm/jre-1.7.0-ibm
lrwxrwxrwx 1 root root 28 Mar 22 13:23 jre_1.7.0 → /usr/lib64/jvm/jre-1.7.0-ibm
lrwxrwxrwx 1 root root 36 Mar 22 13:23 jre_1.7.0_exports → /usr/lib64/jvm-exports/jre-1.7.0-ibm
lrwxrwxrwx 1 root root 36 Mar 22 13:23 jre_exports → /usr/lib64/jvm-exports/jre-1.7.0-ibm
lrwxrwxrwx 1 root root 28 Mar 22 13:23 jre_ibm → /usr/lib64/jvm/jre-1.7.0-ibm
lrwxrwxrwx 1 root root 36 Mar 22 13:23 jre_ibm_exports → /usr/lib64/jvm-exports/jre-1.7.0-ibm
lrwxrwxrwx 1 root root 40 Mar 22 13:23 keytool → /usr/lib64/jvm/jre-1.7.0-ibm/bin/keytool
lrwxrwxrwx 1 root root 43 Mar 22 13:23 policytool → /usr/lib64/jvm/jre-1.7.0-ibm/bin/policytool
lrwxrwxrwx 1 root root 37 Mar 22 13:23 rmid → /usr/lib64/jvm/jre-1.7.0-ibm/bin/rmid
lrwxrwxrwx 1 root root 44 Mar 22 13:23 rmiregistry → /usr/lib64/jvm/jre-1.7.0-ibm/bin/rmiregistry
lrwxrwxrwx 1 root root 42 Mar 22 13:23 tnameserv → /usr/lib64/jvm/jre-1.7.0-ibm/bin/tnameserv

server:/etc/alternatives # rpm -qa --list java-1_7_0-ibm | grep /usr/lib64 | more
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jaas-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jaas-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jaas.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jce-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jce-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jce.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jdbc-stdext-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jdbc-stdext-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jdbc-stdext-3.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jdbc-stdext.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-cos-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-cos-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-cos.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-ldap-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-ldap-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-ldap.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-rmi-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-rmi-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi-rmi.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jndi.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jsse-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jsse-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/jsse.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/sasl-1.7.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/sasl-1.7.0_sr4.0.jar
/usr/lib64/jvm-exports/java-1.7.0-ibm-1.7.0/sasl.jar

It’s just where the supporting language, timezone, and other jar files live.