1. Uninstall the JDK that comes with the Linux system
Java-version
Rpm-qa | Grep-i Java
We're going to delete our own JDK environment.
RPM-E--nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.i686
RPM-E--nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686
Query again whether it has been deleted
2. Install the JDK you downloaded
2.1 Download JDK, Address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Using a 32-bit Linux system, so download 32-bit, you can use the command query is 32-bit or 64-bit
Getconf Long_bit
2.2 Upload the JDK to the server and unzip it to the directory you created.
Mkdir-p/usr/local/java
Unzip the JDK below/usr/local/java
TAR-ZXVF jdk-8u171-linux-i586.tar.gz-c/usr/local/java/
cd/usr/local/java/jdk1.8.0_171/
3. Configure Environment variables
3.1 Editing the Linux environment variable file
Vim/etc/profile
Press I to insert
3.2 Adding a Java Variable environment
#java configjava_home=/usr/local/java/jdk1.8.0_171classpath=.: $JAVA _home/lib/tools.jarpath= $JAVA _home/bin:$ Pathexport java_home CLASSPATH PATH
Press ESC to exit edit mode, enter: Wq save
3.3 Save the variable file, reload the variable
The input Java command will prompt
Reload environment variable configuration file
Source/etc/profile
4. Test whether the installation is successful
Executive Java,javac
Java Configuration Complete
Linux System Java Environment configuration