1, to the official website download Jdk-6u32-linux-x64.bin
2, copy files to Ubuntu desktop, if installed Vmtools, drag directly to the desktop, as shown in the figure:
3. In the/usr/lib/directory, create a new Java folder, as shown in figure:
cd/usr/lib/
sudo mkdir java
4. Copy the Jdk-6u32-linux-x64.bin file to the/usr/lib/java directory.
CD ~
CD desktop/
sudo cp jdk-6u32-linux-x64.bin/usr/lib/java/
5, modify the Jdk-6u32-linux-x64.bin permissions.
sudo chmod 777 Jdk-6u32-linux-x64.bin
6. Run the bin file.
The picture shown below should be successful.
7, to this step/usr/lib/java directory has a folder
8, modify/etc/profile, add environment variable.
Add the following lines to the open file:
Export JAVA_HOME=/USR/LOCAL/JAVA/JDK1.6.0_32 export
jre_home=/usr/local/java/jdk1.6.0_32/jre
Export Classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
export path= $JAVA _home/bin: $JRE _home/bin: $JAVA _home:$ PATH
9, do not restart the machine, so that the file just changed into effect.
Source/etc/profile
10. Set the installed JDK to the default value
sudo update-alternatives--install/usr/bin/java java/usr/lib/java/jdk1.6.0_32/bin/java
sudo Update-alternatives--install/usr/bin/javac Javac/usr/lib/java/jdk1.6.0_32/bin/javac 300
11. See if the installation is successful
Java-version