OpenSUSE Logo

Install Java SE 7 on Linux OpenSUSE 12.1

We already know that SUSE decided to drop Oracle Java package starting with OpenSUSE 12.1 release due to licensing changes. It comes with pre-installed OpenJDK 1.6.0_22 instead.

You can check the java version installed in the system by typing ‘java -version’ via command line in a terminal window.

Here for example:

$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (suse-1.2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

Though they dropped the Oracle Java from their packages list, we are still able to install the Oracle Java SE 7 (JDK 1.7) to OpenSUSE 12.1. This tutorial shows you how to install Java SE 7 (JDK 1.7) on OpenSUSE 12.1. Basically this tutorial should be applicable for all Linux distributions including Ubuntu, CentOS, Fedora, Slackware, RedHat, Debian and Linux Mint.

1. First we have to disable the installed java.

There must be only one Java version installed to avoid system confusing. Search where all the java executable files are installed and then make them non-executable.

$ which java
/usr/bin/java

$ which javaws
/usr/bin/javaws

$ sudo chmod -x /usr/bin/java*

2. Download the Java SE 7 from http://www.oracle.com/technetwork/java/index.html. At the time of this writing, the version of Java SE is Java SE 7 Update 2 (Java SE 7u2).

3. Once it’s downloaded, extract and move it to a system folder (I prefer to move it to /opt folder)

$ tar zxf jdk-7u2-linux-x64.tar.gz 
$ sudo mv jdk1.7.0_02 /opt/

4. I prefer to symlink the jdk1.7.0_02 folder to a java folder as follow:

$ cd /opt/
$ sudo ln -s jdk1.7.0_02 java

5. Add the java bin folder into the system PATH.

$ export PATH=$PATH:/opt/java/bin

To make the Java path set at boot, you need to update the /etc/profile or .profile to include /opt/java/bin

6. Finally the Java SE 7 has been successfully installed. Type ‘java -version’ in terminal window to verify it.

$ java -version
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)

Published by

ComputechTips

Computer and tech-related tips including how-tos, tutorials, and guides. Follow me at Twitter (@computechtips) and Google+ (google.com/+ComputechtipsWeb)