Setting up Java for Linux Download the latest version of the Java JDK (version 6 update 25 as of writing this document) from here: http://www.oracle.com/technetwork/java/javase/downloads/index.html Click the “Download JDK” button.

Accept the license and download the file specific to your machine. There are two different types of installer for Linux: RPM Installer and Self Extracting Installer. You can choose any and select the 32- bit (x86) or 64-bit(x64) based on the system you are installing it in. (Note: If the RPM installer does not work for your Linux Distribution try the Self Extracting Installer and vice versa.)

There is good step-by-step documentation available for all versions here: JDK RPM Installation for Linux (32-bit) JDK Self-Extracting Binary Installation for Linux (32-bit) JDK RPM Installation for Linux (64-bit) JDK Self-Extracting Installation for Linux (64-bit)

The JDK installer also installs JRE. So if you have installed JDK in the location :

“/usr/local/jdk1.6.0_25” then jre is located at “/usr/local/jdk1.6.0_25/jre”

We will now set the JAVA_HOME and JRE_HOME environment variables. From you command line, open the .bash_profile file using your favorite text editor. Here we are using nano

>nano ~/.bash_profile Add the following text to file. If you JDK and JRE is installed in a different directory from the ones used in this document then replace it with the correct location.

JAVA_HOME=/usr/local/jdk1.6.0_25 export JAVA_HOME JRE_HOME=/usr/local/jdk1.6.0_25/jre export JRE_HOME PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export PATH Save and close the file. Just logout of the system and login back to the see the new changes. Type the following commands and check if it returns the correct locations

> echo $JAVA_HOME /usr/local/jdk1.6.0_25 > echo $JRE_HOME /usr/local/jdk1.6.0_25/jre

Note: These are the general instructions for setting the environment variables. The settings and instructions might differ based on your Linux distribution. If they do not work please search for a solution on the internet.

Setting-Up-Java-for-Linux.pdf

Page 1 of 3. Setting up Java for Linux. Download the latest version of the Java JDK (version 6 update 25 as of writing this document). from here:.

87KB Sizes 4 Downloads 204 Views

Recommend Documents

No documents