setting up java for linux

3
8/6/2019 Setting Up Java for Linux http://slidepdf.com/reader/full/setting-up-java-for-linux 1/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: 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.)

Upload: saby83

Post on 07-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Setting Up Java for Linux

8/6/2019 Setting Up Java for Linux

http://slidepdf.com/reader/full/setting-up-java-for-linux 1/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:

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.)

Page 2: Setting Up Java for Linux

8/6/2019 Setting Up Java for Linux

http://slidepdf.com/reader/full/setting-up-java-for-linux 2/3

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/jreexport 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

Page 3: Setting Up Java for Linux

8/6/2019 Setting Up Java for Linux

http://slidepdf.com/reader/full/setting-up-java-for-linux 3/3

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.