Install jdk-7u10-linux-x64.tar.gz in Ubuntu 12.10
General principle: Decompress the jdk-7u10-linux-x64.tar.gz package to/usr/lib/JDK, set the JDK environment variable, and change it to the default JDK
1.copy jdk-7u5-linux-x64.tar.gz to the/usr/lib/JDK/directory. If no JDK folder exists, create the folder. Run the following command:
Sudo mkdir JDK // create a folder JDK
Sudo CP-R ~ /Download/jdk-7u10-linux-x64.tar.gz/usr/lib/JDK // copy the downloaded file to the new directory
Sudo tar-zxvg jdk-7u10-linux-x64.tar.gz // Extract files
2. 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/JDK/jdk1.7.0 _ 10
Export jre_home =/usr/lib/JDK/jdk1.7.0 _ 10/JRE
Export Path = $ java_home/bin: $ java_home/JRE/bin: $ path
Export classpath = $ classpath:.: $ java_home/lib: $ java_home/JRE/lib
3. Modify the default JDK of the system.
$ Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JDK/jdk1.7.0 _ 10/bin/Java 300
$ Sudo Update-alternatives -- install/usr/bin/javac/usr/lib/JDK/jdk1.7.0 _ 10/bin/javac 300
$ Sudo Update-alternatives -- config Java
$ Sudo Update-alternatives -- config javac
4. Check and enter Java-version
Java version "1.7.0 _ 10"
Java (TM) se Runtime Environment (build 1.7.0 _ 10-b18)
Java hotspot (TM) 64-bit server VM (build 23.6-b04, mixed mode)