First, the unloading system comes with the OPENJDK
1, query the system built-in JDK, using the command as follows:
Rpm-qa | grep java
The JDK that exists on the system is listed at this point, and if it exists, it is uninstalled and installed directly.
2. To uninstall, use the following command:
RPM-E--nodeps JDK Related name
After uninstalling the JDK can be installed, the related query and uninstall operations as follows:
Second, JDK installation
1. Download the JDK and upload it to the/usr/java directory.
JDK7: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Select the corresponding Linux version and download the rpm file. The choice here is jdk-7u79-linux-x64.rpm. and uploaded to the Linux/urs/java directory (created if the Java directory does not exist).
2. Decompression and Installation
Run the following command to unzip
RPM-IVH RPM file name
The associated run results are as shown
3. Configure profile file
Run the following command
Vi/etc/profile
Add the following to the end of the profile file and keep
Export Java_home=/usr/java/jdk1.7.0_79export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _ Home/lib/tools.jarexport path= $PATH: $JAVA _home/bin
/usr/java/jdk1.7.0_79 refers to the path of the JDK.
After saving, run the following command to make the configuration effective
Source/etc/profile
To check if the JDK is installed successfully, run the following command
Java-version
The relevant operation diagram is as follows:
CentOS 7 Installation JDK