Ubuntu12.04 install JDK 7
1. Download jdk-7u4-linux-i586.tar.gz to oracle_download first
2. Copy jdk-7u4-linux-i586.tar.gz to the/usr/lib/JVM/directory. If no JVM folder exists, create the folder. Run the following command:
Sudo mkdir JVM // create a folder JVM
Sudo CP-R ~ /Download/jdk-7u4-linux-i586.tar.gz/usr/lib/JVM // copy the downloaded file to the directory created by the heart
Sudo tar-zxvf jdk-7u4-linux-i586.tar.gz // Extract files
3. 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/jdk1.7.0 _ 04
Export Path = $ java_home/bin: $ java_home/JRE/bin: $ path
Export classpath = $ classpath:.: $ java_home/lib: $ java_home/JRE/lib
4. Modify the default JDK of the system.
$ Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/java1.7.0 _ 04/bin/Java 300
$ Sudo Update-alternatives -- install/usr/bin/javac/usr/lib/JVM/java1.7.0 _ 04/bin/javac 300
$ Sudo Update-alternatives -- config Java
$ Sudo Update-alternatives -- config javac
5. Check and enter Java-version
Java version "1.7.0 _ 04"
Java (TM) se Runtime Environment (build 1.7.0 _ 04-b20)
Java hotspot (TM) server VM (build 23.0-b21, mixed mode)