General idea: Decompress the jdk-7u10-linux-x64.tar.gz package to the/usr/lib/examples directory and copy it to the/usr/lib/jdk/directory. If there is no jdk folder, create the folder. command:
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)