System environment: CentOS Linux 7
Current User: Normal user
Installing jdk:jdk-10.0.1_linux-x64_bin.tar.gz
: http://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html
Because CentOS 7 has built-in OPENJDK, java-version verification can be performed through the terminal.
1. View and uninstall the built-in OEPNJDK (normal user uninstall requires root access first)
Get root Permissions
Su Root
Query command:
Rpm-qa | grep JDK
Uninstall command:
RPM-E--nodeps The name that you queried above
2. Drag the JDK downloaded from the physical machine to the virtual machine (or download it directly to the virtual machine via the virtual machine's own browser)
Because it is a normal user, it can only be dragged to the directory under which the user belongs, and the other directories do not have permissions.
3. Unzip. There are two ways: one is directly extracted by the self-brought program, and one is extracted by the command line method. (The command line method is used here)
Right-click Open in Terminal (open terminal) directly in the directory
Decompression command:
TAR-ZXVF jdk-10.0. 1_linux-x64_bin.tar.gz
4. Move the extracted folder to the appropriate directory (requires root access)
5. Setting environment variables (requires root access)
To open the profile file:
Vim/etc/profile
Add the following to the end of the profile file:
Export java_home=/app/java/jdk-10.0. 1 export CLASSPATH=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/Tools.jarexport PATH= $PATH: $JAVA _home/bin
After saving, the configuration file takes effect when you execute the following command:
Source/etc/profile
If you find that the command has not yet taken effect, or if you are executing a Java command prompt in another directory, "This command cannot be found," You can restart it and look again.
6. Create a soft link (can be ignored)
If you find that you cannot execute Java and JAVAC commands under another directory, you can resolve them by creating a soft link.
Ln-s/app/java/jdk-10.0. 1/bin/java/sbin/-s/app/java/jdk-10.0. 1/bin/javac/sbin/javac
7. Verify that the configuration is successful
CentOS Use-record Contos 7 build Java Environment