CD/usr/lib
Sudo mkdir JVM
Sudo tar zxvf jdk-7-linux-i586.tar.gz-C/usr/lib/JVM
CD/usr/lib/JVM
Sudo MV jdk1.7.0/Java-7-sun
Modify Environment Variables
Vim ~ /. Bashrc
Export java_home =/usr/lib/JVM/Java-7-sun
Export jre_home =$ {java_home}/JRE
Export classpath =. :$ {java_home}/lib :$ {jre_home}/lib
Export path =$ {java_home}/bin: $ path
Add $ path. Otherwise, the system path will be overwritten.
Source ~ /. Bashrc
Configure the default JDK version
Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/Java-7-sun/bin/Java 300
Sudo Update-alternatives -- install/usr/bin/javac/usr/lib/JVM/Java-7-sun/bin/javac 300
Sudo Update-alternatives -- install/usr/bin/Jar/usr/lib/JVM/Java-7-sun/bin/jar 300
Sudo Update-alternatives -- config Java
Enter 1, 2, and 3 to represent the default JDK version.
Java-version
Java version "1.7.0 _ 03"
Java (TM) se Runtime Environment (build 1.7.0 _ 03-b04)
Java hotspot (TM) server VM (build 22.1-b02, mixed mode)
If Java: cannot execute binary file appears, it is generally an operating system version.