In the previous Linux exploration article http://www.cnblogs.com/Kidezyq/p/8782728.html, there is a command to install native OpenJDK through the yum
instruction. At that time, a great god gave a comment, suggesting that it is best to install sun's JDK. I searched the Internet for the difference between JDK and OpenJDK, and it can be generally considered that OpenJDK is a simplified version of JDK. The specific difference can refer to this knowing question: https://www.zhihu.com/question/19646618
Not much to say, here is the process of re-installing sun's JDK using rpm after installing OpenJDK:
rpm -qa|grep jdk
yum -y remove java XXXXX
to uninstall the jdk related installation package found in the previous sectionwget here http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/ jdk-8u171-linux-x64.rpm
As a result, the downloaded package is very small and obviously wrong. Later, I simply download it directly to the local PC, and then upload it to the CentOS server through the rz jdk-8u171-linux-x64.rpm
commandrpm -ihv jdk-8u171-linux-x64.rpm
as rootjava
and javac
commands, which can be executed correctly. However, it is necessary to set environment variables on the Internet. In order to prevent various unknown errors in the future, they are also set here. Execute under root: vi /etc/profile
, add the following configuration at the end of the file:export JAVA_HOME=/usr/java/jdk1.8.0_171-amd64 export CLASSPATH=.:
touch /etc/profile
Tips
1. Related parameter description of rpm command:
- a: Query all packages;
- b<Completion stage><Package file>+or-t <Completion stage><Package file>+:设置包装套件的Completion stage,并指定Package file的文件名称;
- c: Only configuration configuration files are listed, this parameter needs to cooperate"-l"Parameter usage;
- d: Only text files are listed, this parameter needs to cooperate"-l"Parameter usage;
- e<Package file>or--erase<Package file>: Delete the specified package;
- f<file>+:查询拥有指定file的套件;
- h or--hash: List the tags when the kit is installed;
- i: Display related information of the kit;
- i<Package file>or--install<Package file>:安装指定的Package file;
- l: Display the file list of the suite;
- p<Package file>+:查询指定的RPMPackage file;
- q: Use the query mode, when encountering any problems, the rpm command will first ask the user;
- R: Display the relevance information of the kit;
- s: display the file status, this parameter needs to cooperate"-l"Parameter usage;
- U<Package file>or--upgrade<Package file>:升级指定的Package file;
- v: Display the execution process of instructions;
- vv: Display the instruction execution process in detail for easy troubleshooting.
2. How to find the path where the rpm installation software is located:
a.First pass`rpm -qa|grep jdk`Find the jdk installed via rpm
b.Pass again`rpm -ql XXX`Find it
Recommended Posts