Copy the supervisor to the/usr/lib/jvm/directory and run the following command: sudocp-r ~ /Download/jdk-7u5-linux-x64.tar.gz if there is no jvm folder here, create the folder, command: sudomkdirjvm enter/usr/lib/jvm
1. First download jdk-7u5-linux-x64.tar.gz to oracle.cn
2. Copy jdk-7u5-linux-x64.tar.gz to the/usr/lib/jvm/directory,
Command:
Sudo cp-r ~ /Download/jdk-7u5-linux-x64.tar.gz
If there is no jvm folder, create the folder. command:
Sudo mkdir jvm
Go to the/usr/lib/jvm directory
Cd/usr/lib/jvm
Decompress the file to the following command:
Sudo tar-zxvf jdk-7u5-linux-x64.tar.gz
3. Set environment variables and use gedit to open the/etc/profile file.
Sudo gedit/etc/profile
Add the following at the end of the file:
Export JAVA_HOME =/usr/lib/jdk1.7.0 _ 05
Export PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH
Export CLASSPATH = $ CLASSPATH:.: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib
4. Modify the default jdk.
$ Sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/jdk1.7.0 _ 05/bin/java 300
$ Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jvm/JDK 1.7.0 _ 05/bin/javac 300
$ Sudo update-alternatives -- config java
$ Sudo update-alternatives -- config javac
5. Check and enter the command line:
Java-version
The following result is displayed, indicating that the configuration is complete.
Java version "1.7.0 _ 05"
Java (TM) SE Runtime Environment (build 1.7.0 _ 05-b05)
Java HotSpot (TM) 64-Bit Server VM (build 23.1-b03, mixed mode)