Before installation, you can check the jdk version, enter the Ubuntu terminal $ java-version, and press Enter. You can see that the jdk version is 1.4.2. 1. Manually install JDK 6 first, download the http://java.sun.com in the jdk-6u12-linux-i586.bin, it is said that this operation is relatively simple, do not need to switch. Then, you can place it in any folder you like. If you are a cainiao like me, we suggest placing it in the main folder (/home /*)
Before installation, you can check the jdk version, enter the Ubuntu terminal $ java-version, and press Enter. You can see that the jdk version is 1.4.2.
1. Manually install JDK 6
First, download the http://java.sun.com in the jdk-6u12-linux-i586.bin, it is said that this operation is relatively simple, do not need to switch.
Then, you can place it in any folder you like. If you are a cainiao like me, it is recommended to put it under the main folder (/home.
Install jdk as follows:
Enter your jdk-6u12-linux-i586.bin under the terminal, for example, my location is:/home/liangshihong
$ Sudo-s./jdk-6u12-linux-i586.bin
Press enter until you are asked whether to install it. Enter yes and press Enter.
OK. After the installation is complete, configure the environment variables below.
Configure classpath and modify the environment variables of all users
$ Sudo gedit/etc/profile
Add at the end of the file
# Set java environment
JAVA_HOME =/home/liangshihong/jdk1.6.0 _ 12
Export JRE_HOME =/home/liangshihong/jdk1.6.0 _ 12/jre
Export CLASSPATH =.: $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH
Export PATH = $ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH
Restart the computer and run the command to test the jdk version.
Java-version
The following information is displayed: the installation is successful.
Java version "1.6.0 _ 12"
Java (TM) SE Runtime Environment (build 1.6.0 _ 12-b04)
Java HotSpot (TM) Server VM (build 11.2-b01, mixed mode)
Liangshihong @ liangshihong-Imagine :~ $