Saturday, July 19, 2014

Successful installation of Java Development Kit on Linux platforms

This procedure install Java SE Development Kit in openSUSE Linux, but it can be applied for any other Linux distribution. (Please, consult your distribution documentation.)

1. Download the Java SE Development Kit from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select the tarball (".tar.gz" file extension) for the appropiate architecture (32 or 64 bits).
     For this explanation, I suppose the file is downloaded to "Downloads" directory of the "username" home directory ("/home/username/Downloads/").

2. As a root user, move the downloaded file to the installation directory and unpack the tarball.
$ su
Password: <Type the root password>
# mkdir /usr/java/
# cd /usr/java/
# mv /home/username/Downloads/jdk-<version>-linux-<arch>.tar.gz .
# tar -zxvf jdk-<version>-linux-<arch>.tar.gz
     In this step, Java was unpacked on "/usr/java/" directory. Now, you can remove the downloaded file:
# rm jdk-<version>-linux-<arch>.tar.gz
3. Create a symbolic link to the JDK installation directory.
# ln -s /usr/java/jdk<version> default
4. Set the "JAVA_HOME" environment variable.
# cd /etc/profile.d/
# cat >> java.sh
export JAVA_HOME=/usr/java/default
<CTRL + C>
#
5. Set the JDK tools in "PATH" environment variable.
# cd /etc/
# cat >> bash.bashrc.local
PATH=$JAVA_HOME/bin:$PATH
export PATH
<CTRL + C>
#

No comments:

Post a Comment