查看已安装的JDK版本:
java -version
查看已安装的JDK:
rpm -qa | grep jdk
卸载JDK:
rpm -e --nodeps [JDK name1] [JDK name2] [JDK name3]
或者
yum -y remove [JDK name1] [JDK name2] [JDK name3]
查看JAVA相关文件:
rpm -qa | grep java
卸载JAVA相关文件:
rpm -e --nodeps [name1] [name2] [name3]
解压JDK安装包:
tar -zxvf [jdk-xuxxx-linux-xxx.tar.gz]
移动解压后文件至/usr/local/jdk:
mv [jdkx.x.x_xxx] /usr/local/jdk
配置:
sed -i '$a ulimit -n 65535' /etc/profile
sed -i '$a export JAVA_HOME=/usr/local/jdk' /etc/profile
sed -i '$a export JRE_HOME=$JAVA_HOME/jre' /etc/profile
sed -i '$a export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH' /etc/profile
sed -i '$a export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH' /etc/profile
source /etc/profile
检测安装是否成功:
java -version
javac