Search This Blog

Sunday, December 7, 2014

Installing JDK 1.7 on ubuntu server

Follow the following steps to install JDK 1.7 on ubuntu server:


1. Based on your linux architecture, download the proper version from Oracle website (Oracle JDK 1.7)

2. Then, uncompress the jdk archive using the following command:  

tar -xvf jdk-7u65-linux-i586.tar
Or using the following command for 64 bits:
tar -xvf jdk-7u65-linux-x64.tar

3. Create a folder named jvm under (if not exists) using the following command 
sudo mkdir -p /usr/lib/jvm
4. Then, move the extracted directory to /usr/lib/jvm:
sudo mv ~/Downloads/jdk1.7.0_71 /usr/lib/jvm/
5. Run the following commands to update the execution alternatives:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_71/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_71/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_71/bin/javaws" 1

6. Finally, you need to export JAVA_HOME variable:

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_71

or it is better to set JAVA_HOME in .bashrc:

nano ~/.bashrc 

then add the same line:

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_71

No comments:

Post a Comment