Thursday, February 5, 2015

Installing Oracle JDK in Linux(Ubuntu,Debian,Redhat)

Here is Manual way to install Oracle JDK on your Linux System:

Step 1:

Download Oracle JDK from Oracles Official website ...for example here I am using oracle jdk 7 downloaded fram here :http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 
It has a ".tar.gz" file extension.Download 64-bit or 32-bit according to your requirment.For checking your sytem version on Ubuntu type in terminal lsb_release -a or in Redhat type uname -afor my example file is : jdk-7u75-linux-x64.tar.gz


Step 2:

Uncompress the downloaded file by using terminal command...First open  your terminal brows to that file path (i.e.jdk-7u75-linux-x64.tar.gz)  . In terminal type the following command:

>tar -xvf jdk-7u75-linux-x64.tar.gz
now it will extract the file in given folder

Step 3:

Now chenge the file permission of the folder so that it will be easy to work with any account..by using followng command change folder permission:

>chmod -R 777  jdk1.7.0.75/

or in ubuntu type

> sudo chmod -R 777  jdk1.7.0.75/

where  jdk1.7.0.75/ is your extracted folder name

Step 4:

Now Copy Folder to /opt/ folder so that evry account can access it
to copy whole folder and data ...................type following command

>cp -R  jdk1.7.0.75/       /opt/

or in ubuntu type

>sudo cp -R  jdk1.7.0.75/       /opt/


Step 5:

Now run following commands to config the java on your system
in ubuntu terminal type given command one by one

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk1.8.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/jdk1.8.0/bin/javaws" 1


for other linux just remove the sudo and your done

Step 6:

Checking is it installd correctly or Not,,type in terminal

>sudo update-alternatives --config java

>java -version



and it will display you the java version installed on your system ....and your done with your installation