Linux下JDK的安装及卸载

下载:jdk-6u21-linux-i586-rpm.bin (下载页面http://zh.sourceforge.jp/projects/sfnet_crawlzilla/downloads/other/jdk-6u21-linux-i586-rpm.bin/)

查看系统是否已经默认安装了java,如果有则卸载掉原系统内的java

查看方法:rpm –qa |grep –I java

卸载方法:rpm –e –nodeps java*包名

将jdk-6u21-linux-i586-rpm.bin给予可执行权限

修改权限:chmod u+x jdk-6u21-linux-i586-rpm.bin

执行:./ jdk-6u21-linux-i586-rpm.bin

[root@localhost ~]# ./jdk-6u21-linux-i586-rpm.bin

Unpacking…

Checksumming…

Extracting…

UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).

inflating: jdk-6u21-linux-i586.rpm

inflating: sun-javadb-common-10.5.3-0.2.i386.rpm

inflating: sun-javadb-core-10.5.3-0.2.i386.rpm

inflating: sun-javadb-client-10.5.3-0.2.i386.rpm

inflating: sun-javadb-demo-10.5.3-0.2.i386.rpm

inflating: sun-javadb-docs-10.5.3-0.2.i386.rpm

inflating: sun-javadb-javadoc-10.5.3-0.2.i386.rpm

Preparing… ########################################### [100%]

1:jdk ########################################### [100%]

Unpacking JAR files…

rt.jar…

jsse.jar…

charsets.jar…

tools.jar…

localedata.jar…

plugin.jar…

javaws.jar…

deploy.jar…

Installing JavaDB

Preparing… ########################################### [100%]

1:sun-javadb-common ########################################### [ 17%]

2:sun-javadb-core ########################################### [ 33%]

3:sun-javadb-client ########################################### [ 50%]

4:sun-javadb-demo ########################################### [ 67%]

5:sun-javadb-docs ########################################### [ 83%]

6:sun-javadb-javadoc ########################################### [100%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:

* Notification of new versions, patches, and updates

* Special offers on Sun products, services and training

* Access to early releases and documentation

Product and system data will be collected. If your configuration

supports a browser, the Sun Product Registration form for

the JDK will be presented. If you do not register, none of

this information will be saved. You may also register your

JDK later by opening the register.html file (located in

the JDK installation directory) in a browser.

For more information on what data Registration collects and

how it is managed and used, see:

http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue…..

Done.

查看jdk-6u21-linux-i586-rpm.bin所在目录下已经存在jdk-6u21-linux-i586.rpm

安装jdk: rpm –ivh jdk-6u21-linux-i586.rpm

[root@localhost ~]# rpm -ivh jdk-6u21-linux-i586.rpm

Preparing… ########################################### [100%]

package jdk-1.6.0_21-fcs is already installed

编辑/etc/profile

[root@localhost ~]# vim /etc/profile

在最下面加入如下内容

JAVA_HOME=/usr/java/jdk1.6.0_21 #你的jdk所在目录

PATH=$PATH:$JAVA_HOME/bin

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JAVA_HOME

export PATH

export CLASSPATH

保存退出

使其生效方法:

1) 马上生效:

[root@localhost ~]# source /etc/profile

2)退出生效:在client执行exit

查看是否已生效

[root@localhost ~]# java -version

java version "1.6.0_21"

Java(TM) SE Runtime Environment (build 1.6.0_21-b06)

Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing)

- THE END -
版权声明:
转载原创文章请注明,文章出处://kinggoo.com
原文地址:https://kinggoo.com/sys-linux-jdk-install.htm
发表评论?

2 条评论。

  1. subversion的web客户端svnwebclient的搭建配置 - KingGoo博客 - pingback on 2012 年 03 月 19 日 在 14:32
  2. Linux下Jira安装搭建配置 - KingGoo - pingback on 2011 年 02 月 12 日 在 16:26

发表评论


此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

Trackbacks and Pingbacks: