linux jdk安装卸载

时间:2021-04-17 15:08:21

卸载jdk

[root@n6 ~]# rpm -qa|grep jdk     //查询已安装的jdk
java-1.7.0-openjdk-1.7.0.79-2.5.5.3.el6_6.x86_64
[root@n6 ~]# #rpm -e --nodeps ava-1.7.0-openjdk-1.7.0.79-2.5.5.3.el6_6.x86_64      //卸载已安装的jdk

[root@n6 soft]# chmod u+x jdk-6u45-linux-x64.bin       //给jdk安装文件执行权限

[root@n6 soft]# ./jdk-6u45-linux-x64.bin      //安装jdk   

[root@n6 jdk1.6.0_45]# vi /etc/profile      //配置jdk环境变量

export JAVA_HOME=/opt/soft/jdk1.6.0_45
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH

[root@n6 jdk1.6.0_45]# source /etc/profile    //使配置文件立即生效

[root@n6 jdk1.6.0_45]# java -version      //测试成功
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)