I'm stuck with this problem for a long time and can't solve it. In fact, the jdk is not installed properly. Please uninstall it before installing and reinstall
Ideas
Use yum to install jdk
Before installation: uninstall jdk first
1. Uninstall
Check whether the system comes with jdk
rpm -qa |grep java
rpm -qa |grep jdk
rpm -qa |grep gcj
If there is output information, the batch uninstall system comes with
rpm -qa | grep java | xargs rpm -e --nodeps
rpm -qa | grep jdk | xargs rpm -e --nodeps
2. Installation
Check which installation packages are available in jdk
yum list java-1.8*
Installation package
yum install java-1.8.0-openjdk* -y
```bash
3、配置环境变量
yum install java-1.8.0-openjdk* -y
vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
export PATH=${JAVA_HOME}/bin:$PATH
备注:修改环境变量键盘操作 按(a) 结束环境变量修改 按esc键 和(:wq!)
Execute the command: The configured environment variable takes effect
source /etc/profile
4. Check whether the installation is successful
java -version