1. Uninstall the previous JDK and mark all options that contain openjdk in the new version to completely delete it. Or execute sudo apt-Get autoremove openjdk-6-jre 2, download JDK Software
Follow these steps to install Sun JDK:
Slave.
Then configure the Java environment variable:
Set environment variables: Vim/etc/profile or Vim ~ /. Bashrc, add:
Export java_home =/share/software/jdk1.7.0 _ 17
Export Path = $ path: $ java_home/bin: $ java_home/JRE/bin
Export classpath =.: $ java_home/JRE/lib/: $ java_home/lib
Export LD_LIBRARY_PATH = $ java_home/JRE/lib/i386: $ java_home/JRE/lib/i386/Server
3. Configure JDK software: Run: sudo Update-alternatives -- install/Usr/bin/Java/share/software/jdk1.7.0 _ 17/bin/Java300 sudo Update-alternatives -- install/Usr/bin/javac/share/software/jdk1.7.0 _ 17/bin/300 modify the red part by yourself; execute: Update-alternatives -- config Java
Two candidate items can be used to replace Java (/usr/bin/Java ).
Select the path priority status
------------------------------------------------------------
* 0/usr/lib/JVM/java-7-openjdk-i386/JRE/bin/Java 1071 automatic mode
1/share/software/jdk1.7.0 _ 17/bin/Java 300 manual mode
2/usr/lib/JVM/java-7-openjdk-i386/JRE/bin/Java 1071 manual mode
Enter the selected number: 1
Enter
4. Verify the Java
-Version: changed to Sun's JRE.
Run:
Java
Version "1.7.0 _ 17"
Java (TM) se Runtime Environment (build 1.7.0 _ 17-b02)
Java hotspot (TM) server VM (build 23.7-b01, mixed mode)