There is always some version incompatibility when configuring the Java JDK, so let's talk about how to switch the JDK version.
My system comes with a JDK that is 1.6 execution java-version
1.JDK Installation
You can first use the command to install the JDK directly
sudo apt-get install Openjdk-7-jre openjdk-7-jdk.
You can also download the installation package post-pass command installation
TAR-ZXVF jdk-7u10-linux-i586.tar.gz
2. Add JDK:
Update-alternatives--install/usr/bin/java Java/usr/lib/jvm/java/jdk1.7.0_10/bin/java 300update-alternatives-- Install/usr/bin/javac Javac/usr/lib/jvm/java/jdk1.7.0_10/bin/javac 300 Note: The JDK1.7.0_10 version is subject to change
3. Check to see if the JDK is in the Ubuntu JDK menu:
sudo update-alternatives--config javasudo update-alternatives--config Javac
The results are as follows
Select serial number, enter can;
4. Then java-version,javac-version view the current JDK version
Ubuntu How to install switch JDK version