Ubuntu14.04 install jdk1.7

1. Download jdk-7u45-linux-x64.tar.gz 

     URL: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2, Unzip the JDK

         Go to the download directory of the JDK

Html code   Favorite code
  1. sudo tar zxvf jdk-7u45-linux-x64.tar.gz  -C /usr/lib/jvm   

 3, set environment variables (global)

Java code   Favorite code
  1. sudo gedit  /etc/profile  

   Open the profile file and enter

Java code   Favorite code
  1. export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65  
  2. export CLASSPATH=".:$JAVA_HOME/lib:$CLASSPATH"  
  3. export PATH="$JAVA_HOME/bin:$PATH"  

 4, set the system default JDK

Java code   Favorite code
  1. sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_65/bin/java 300  
  2. sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_5/bin/javac 300  
  3. sudo update-alternatives --config java  

 5, Verify JDK

   input the command

Java code   Favorite code
  1. java -version  

   Seeing the JDK information means success.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326562716&siteId=291194637