Install JDK8 under CentOS to install JDK8 as an example
First, download the decompression JDK
1. Go to http://www. Oracle. com/technetwork/java/javase/downloads/ Download the JDK installation file jdk-8u60-linux-x64.tar.gz in jdk8-downloads-2133151.html.
2. Create a new/usr/java folder, place the jdk-8u60-linux-x64.tar.gz under the folder, and switch to the/usr/java directory.
3. Execute the command tar zxvf jdk-8u60-linux-x64.tar.gz to extract the Jdk1.8.0_60 folder after extracting/usr/java directory.
4. With the above steps, the JDK installation is complete. The following begins configuring environment variables.
Second, configure environment variables
1. Execute the Command vim/etc/profile edit the profile.
2. Add the following to the bottom of the/etc/profile:
Java_home=/usr/java/jdk1.8.0_60
Path= $JAVA _home/bin: $PATH
Classpath= $JAVA _home/jre/lib/ext: $JAVA _home/lib/tools.jar
Export PATH java_home CLASSPATH
3. Press insert for insertion operation Press ESC to end insert shift+ colon input QW write and save
4. Execute the command source/etc/profile make the profile effective immediately
Third, attention
1. Note that the path in the configuration, it is necessary to put $java_home/bin in front, or use the Java command, the system will find the previous Java, do not look down.
In this way, the JAVA executable file run directory is not $java_home/bin, and in other directories, will cause a lot of problems.
2. With the javac command, no command not found error occurs.
3. Using Java-version, a version of Java Edition "1.8.0_60" appears. Description The installation JDK has been installed successfully!
Installing the JDK under Linux-centos