This installation is relatively simple, there are countless teaching on the Internet, I am here to record the following, convenient in case of amnesia back to see can remember. Personal blog http://www.cnblogs.com/wdfwolf3/
1. Download and install
Anyway, we need to go to the official Download installation package (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), Choose from your own system. tar.gz suffix installation package, agree to download the agreement. Here is the Java SE installed is a more personal use of the standard version, Java ME is the Enterprise Edition, Java EE is a lightweight system mini-version. Under Directory/usr/lib, create a new folder named Java, and then unzip the downloaded installation package into this folder, sudo tar zxvf jdk-8u92-linux-x64.tar.gz-c/usr/lib/java.
2. Configure Environment variables
Open the file/etc/profile, or open ~/.BASHRC, the difference is that the previous configuration is all users, and the latter file only modifies the current user. Include in the file
Export JAVA_HOME=/USR/LIB/JAVA/JDK1. 8. 0_92 export jre_home=${java_home}/JRE Export CLASSPATH=.:${java_home}/lib:${jre_home}/lib export PATH=${java_home}/bin: $PATH
After you save the exit, execute the source ~/.BASHRC, and enter Java-version to see the version information indicating that the installation was successful.
3. Set the default JDK
Normally, only the JDK8 installed in the system, but if the system was previously loaded with other older versions, it would be necessary to set the following default JDK. Enter the following two lines of code in the terminal, and add the link value to the Java and Javac commands.
Update-alternatives--install/usr/bin/java java/usr/lib/java/jdk1.8.0_92/bin/java 300update-alternatives-- Install/usr/bin/javac Javac/usr/lib/java/jdk1.8.0_92/bin/javac
You can then switch between versions of Java by command Update-alternatives–config java.
UBUNTU1404 Installation Configuration Java environment (JDK8)