Step One uninstall the original or the self with JDK
Some Linux systems will bring OPENJDK, and we'd better remove the original JDK and install it first.
(1) View current JDK version information with the java-version command
Java-version
(2) using Rpm-qa | grep Java command to query the Java installed by the operating system itself
Rpm-qa | grep java
Step two Download the installation JDK
Found on the Internet, most of the JDK download path has been invalidated, so we recommend to Baidu to find their own, or download at the official website. Much of this information is downloaded using the curl+ address, but we need to be clear about the address path. There is also the way to download the installation package directly, and then throw it into the Linux server, and then unpack.
website address : JDK Download address
Download Address : JDK Download address
Sample version of this article: Jdk-7u79-linux-x64.tar.gz
Put the downloaded FTP tool in a designated directory on Linux, for example:/usr/local/jdk7.
No JDK path to create.
(1) Enter the/usr/local directory
Cd/usr/local
(2) Create jdk7 directory
mkdir Jdk7
(3) View the files in the/usr/local/jdk7 directory
Ll/usr/local/jdk7 or Ls/usr/local/jdk7
(4) Decompression JDK Compression pack
(5) If you need to move the JDK installation file path
mv/usr/local/jdk7/jdk1.7.0_79/usr/local/java/jdk1.7.0_79
setting JDK Environment variables
(1) After the installation is completed, you need to configure the environment variables, edit the/etc/profile file
Vi/etc/profile
(2) Add the following configuration at the end of the file
Export java_home=/usr/local/jdk7/jdk1.7.0_79
export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/ Dt.jar: $JAVA _home/lib/tools.jar
export path= $PATH: $JAVA _home/bin
Note: Java_home is the installation directory address of your own JDK installation
(3) Effective JDK environment variables
Source/etc/profile
(4) Check whether the JDK is installed successfully
Java-version