日期:2014-05-16 浏览次数:20484 次
以下参考地址:[url=http://flyer2010.iteye.com/blog/658064]再猛击这里[/url] 1.下载jdk-6u20-linux-i586-rpm.bin 拷贝到/usr/local/目录下 2.进入 cd /usr/local/ 3.增加执行权限 chmod +x jdk-6u20-linux-i586-rpm.bin 4.执行安装命令 ./jdk-6u20-linux-i586-rpm.bin 此时会生成文件jdk-6u20-linux-i586.rpm,同样给所有用户添加可执行的权限 #chmod +x jdk-6u20-linux-i586.rpm 5.安装程序 #rpm -ivh jdk-6u20-linux-i586.rpm 6.安装完成,查看jdk的安装目录,为 /usr/java/jdk1.6.0_20 7.设置JDK环境变量。 #vi /etc/profile 添加如下内容: export JAVA_HOME=/usr/java/jdk1.6.0_20 export JRE_HOME=$JAVA_HOME/jre export PATH=$PATH:/usr/java/jdk1.6.0_20/bin export CLASSPATH=.:/usr/java/jdk1.6.0_20/lib:/usr/java/jdk1.6.0_20/jre/lib 8.在终端使用echo命令检查环境变量设置情况。 #echo $JAVA_HOME #echo $CLASSPATH #echo $PATH 9.检查JDK是否安装成功。 #java -version 10.如果看到JVM版本及相关信息,即安装成功! 卸载linux中已经安装的jdk 卸载步骤: [root@localhost local]# rpm -qa|grep jdk jdk-1.6.0_21-fcs.i586 [root@localhost local]# rpm -e jdk-1.6.0_21-fcs.i586 [root@localhost local]# rpm -qa|grep java sun-javadb-core-10.5.3-0.2.i386 sun-javadb-docs-10.5.3-0.2.i386 sun-javadb-demo-10.5.3-0.2.i386 java-1.5.0-gcj-1.5.0.0-29.fc12.i686 [root@localhost local]# rpm -e java-1.5.0-gcj-1.5.0.0-29.fc12.i686 error: Failed dependencies: java-gcj-compat >= 1.0.43 is needed by (installed) lucene-0:2.3.1-5.5.fc12.i686 java-gcj-compat is needed by (installed) xml-commons-apis-0:1.3.04-3.5.fc12.i686 java-gcj-compat >= 1.0.70 is needed by (installed) sinjdoc-0.5-9.fc12.i686 java-gcj-compat is needed by (installed) xalan-j2-0:2.7.0-9.5.fc12.i686 java-gcj-compat is needed by (installed) jdom-0:1.0-7.5.fc12.i686 java-gcj-compat is needed by (installed) java_cup-1:0.10k-3.i686 jaxp_parser_impl is needed by (installed) xalan-j2-0:2.7.0-9.5.fc12.i686 jaxp_parser_impl is needed by (installed) saxon-0:6.5.5-3.3.fc12.noarch jre >= 1.5.0 is needed by (installed) openoffice.org-ure-1:3.1.1-19.14.fc12.i686 有很多依赖关系,不让卸载,用 rpm -e --nodeps 卸载就行了 [root@localhost local]# rpm -e --nodeps java-1.5.0-gcj-1.5.0.0-29.fc12.i686