1. Uninstalling the JDK#rpm-qa | grep GCJ If the output has no content, it means that there is no JDK, if the output has content, to unload the search to the file, the command is: #rpm-e--nodeps [file output from the previous step] and then use #whereis Java directly delete Java related files or folders
2. Download the JDK you needto Oracle website http://www.oracle.com/technetwork/java/javase/downloads/ jdk8-downloads-2133151.html Find the download link and then use wget download, because Oracle needs to accept Lincence, wget need to add some parameters (--no-check-certificate-- No-cookies--header "Cookie:oraclelicense=accept-securebackup-cookie") like to download the latest jdk8,rpm version of #wget-- No-check-certificate--no-cookies--header "Cookie:oraclelicense=accept-securebackup-cookie" http// download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.rpm
3. Install with RPMCommand #mkdir/usr/local/java#cd/usr/local/java to move the download file to/usr/local/java, and then install the #rpm-ivh JDK-8U92-LINUX-X64.RPM installation of the time will appear waiting for output, no error indicates that the installation was successful
4. Declaring Environment VariablesConfigure the amount of environment #vi/etc/profile (add sudo before the permission) at the bottom of the profile adds the following content #export Java_home=/usr/java/jdk1.8.0_92#export path= $JAVA _ Home/bin#export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar If it is already present, modify it to a new installed path and then add it. After saving exits Execute the following command to make the configuration effective #source/etc/profile
5. View JDK version#java-version
Linux reload jdk with rpm