1. Download jdk1.7.0_79
(32-bit operating system) jdk-7u79-linux-i586.tar.gz
(64-bit operating system) jdk-7u79-linux-x64.tar.gz
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
2. Unzip the JDK
sudo tar zxvf jdk-7u79-linux-i586.tar.gz-c/USR/LIB/JVM
3. Open profile
sudo gedit/etc/profile
Append the contents to the end of the file:
Export java_home=/usr/lib/jvm/jdk1.7.0_79
Export Classpath= ".: $JAVA _home/lib: $CLASSPATH"
Export path= "$JAVA _home/bin: $PATH"
4. Set the system default JDK
sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.7.0_79/bin/java 300
sudo update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.7.0_79/bin/javac 300
sudo update-alternatives--config java
5. Running Source/etc/profile
6, Java-version
Displays the JDK version as "1.7.0_79", which is the successful installation
Note: If picked up Java_tool_options is displayed:-javaagent:/usr/share/java/jayatanaag.jar
Add unset java_tool_options at the end of the ~/.BASHRC file
Add unset java_tool_options at the end of the ~/.zsh file (if the user has zsh installed)
Ubuntu Java JDK Installation and environment variable settings