Installing the JDK in Linux is a trivial matter, just learn Linux to leave a note for yourself. Just install CentOS, which can come with JDK, but this does not affect, just download your own JDK and then replace the corresponding environment variables.
1, download the corresponding JDK, enter the command:
wget http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
2, unzip the source package to the/usr/local/folder, enter the command:
TAR-ZXVF jdk-7u79-linux-x64.tar.gz/usr/local/
3, after you can delete the source package, of course, do not delete the line.
RM jdk-7u79-linux-x64.tar.gz
4, the configuration of the JDK environment variables, the configuration of the environment variables in Linux, the personal understanding is in this file/etc/profile
, so we just need to configure it in this file. Enter the command:
Vi/etc/profile
Open and add at the end:
Export java_home=/user/local/jdk1.7 #最后面jdk1.7 The name needs to fill in the second step after the decompression path
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin
Then press the ESC key to enter: Wq to save the exit. One of the things to note is that the case in Linu is strictly distinguished, and there are no spaces on either side of the equal sign.
5, re-make the profile effective, enter the command:
Source/etc/profile
This configures the environment variable to be effective. Then you can check to see if the JDK is configured to take effect, perform a low six-step
6. View version number
Java-version
If the relevant information is displayed, you have successfully installed it.
Centos 7 Installation jdk1.7