安装jdk
yum install -y java-1.8.0-openjdk.x86_64
默认安装到usr/lib/jvm目录下
查看JDK信息,输入命令:java -version
检测JDK安装包,输入命令:rpm -qa | grep java
进入安装目录。
输入命令:cd /usr/lib/jvm
删除Java相关文件,输入命令:rm -rf /usr/lib/jvm
配置环境
输入命令:vim /etc/profile
- #java environment
- export JAVA_HOME=/home/jdk/jdk1.8.0_261
- export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
- export PATH=$PATH:${JAVA_HOME}/bin
-
- #java environment
- export JAVA_HOME=/home/jdk/jdk1.8.0_261
- export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
- export PATH=$PATH:$JAVA_HOME/bin
-
- #java environment
- export JAVA_HOME=/home/jdk/jdk1.8.0_261
- export JRE_HOME=${JAVA_HOME}/jre
- export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
- export PATH=${JAVA_HOME}/bin:$PATH
输入命令:s