If no root user is created:
1 sudo passwd root
Download JDK (Baidu "JDK" character tar.gz package: jdk-7u55-linux-x64.gz this is the version I downloaded, the name of the specific version of the prevail to switch to the root:
1 su - root
Decompress the file:
1 gunzip jdk-7u55-linux-x64.gz2 tar -xf jdk-7u55-linux-x64
Get the jdk1.7.0 _ 55 folder.
Move to/USR:
1 mv jdk1.7.0_55 /usr
Set environment variables:
1 gedit /etc/profile
Add at the end:
1 export JAVA_HOME=/usr/jdk1.7.0_552 export JRE_HOME=/usr/jdk1.7.0_55/jre3 export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH4 export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
Modify the default JDK:
1 update-alternatives --install /usr/bin/java java /usr/jdk1.7.0_55/bin/java 3002 update-alternatives --install /usr/bin/javac javac /usr/jdk1.7.0_55/bin/javac 300
View the JDK version:
1 java -version
Ubuntuinstall jdk(tar.gz)