linux下用rpm 安装jdk

1.下载jdk的rpm安装包,这里以jdk-6u21-linux-i586-rpm.bin为例进行说明

下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html

 

2. 将jdk-6u21-linux-i586-rpm.bin 移动到合适的安装目录上,安装软件不要在/home路径下,这样很容易涉及到不同用户的访问权限,这样对程序的维护,是相当不利的。这里将把安装包移动到/opt目录

mv jdk-6u21-linux-i586-rpm.bin /opt ;把安装包移动到/opt目录 cd /opt 

 

3. 给安装包赋予运行权限

chmod 755 jdk-6u21-linux-i586-rpm.bin  

 

 

3. 安装该rpm安装包

[root@localhost opt]# ./jdk-6u21-linux-i586-rpm.bin ;运行安装包 Unpacking... Checksumming... Extracting... UnZipSFX 5.50 of 17 February 2002, by Info-ZIP ([email protected]). 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. 

 

4. 设置环境变量

[root@localhost opt]# vi /etc/profile ;编辑系统配置文件 ================================================================================== JAVA_HOME=/usr/java/jdk1.6.0_24/ ;增加以下几行 CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar ;主要是配置路径 PATH=$JAVA_HOME/bin:$PATH ; export JAVA_HOME,PATH,CLASSPATH ; :wq ;保存退出 

 

 

 

 

 

 

 

你可能感兴趣的:(JAVA,Linux)