linux下安裝jdk1.7

首先先檢查linux機器上是否有自帶的jdkhtml

java -version檢查下就能夠,若是有版本低的話能夠先卸載掉方法以下java

[root@localhost java]# rpm -qa|grep gcj 或者 rpm -qa|grep java
libgcj-4.1.2-44.el5
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115node

若是沒有信息就是沒有安裝、若是有那麼以下操做linux

[root@localhost jdk-6u13-linux-i586]# yum -y remove java-1.4.2-gcj-compat-1.4.2.0-40jpp.115   或者 rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package java-1.4.2-gcj-compat.i386 0:1.4.2.0-40jpp.115 set to be erased
--> Processing Dependency: java-gcj-compat for package: antlr
--> Processing Dependency: java-gcj-compat for package: antlr
--> Processing Dependency: java-gcj-compat >= 1.0.64 for package: gjdoc
--> Processing Dependency: java-gcj-compat >= 1.0.64 for package: gjdoc
--> Running transaction check
---> Package antlr.i386 0:2.7.6-4jpp.2 set to be erased
---> Package gjdoc.i386 0:0.7.7-12.el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch     Version                 Repository     Size
================================================================================
Removing:
 java-1.4.2-gcj-compat     i386     1.4.2.0-40jpp.115       installed      441 
Removing for dependencies:
 antlr                     i386     2.7.6-4jpp.2            installed     2.5 M
 gjdoc                     i386     0.7.7-12.el5            installed     1.7 M

Transaction Summary
================================================================================
Install      0 Package(s)         
Update       0 Package(s)         
Remove       3 Package(s)         

Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : antlr                                             [1/3] 
  Erasing        : gjdoc                                             [2/3] 
  Erasing        : java-1.4.2-gcj-compat                             [3/3] 

Removed: java-1.4.2-gcj-compat.i386 0:1.4.2.0-40jpp.115
Dependency Removed: antlr.i386 0:2.7.6-4jpp.2 gjdoc.i386 0:0.7.7-12.el5
oracle

Complete!(看到這個說明完成了。。)ui


接着咱們手動安裝linux的jdk個人spa

下載地址.net

http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

我下載的是rpm包debug

接着執行安裝
code

[root@localhost local]# rpm -ivh jdk-7-linux-i586.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...

個人rpm包就這樣就裝好了。。


接着是配置環境變量

#vi  /etc/profile
在該profile文件中最下面添加:
JAVA_HOME=/usr/java/jdk1.7.0//本身的jdk路徑
JRE_HOME=/usr/java/jdk1.7.0/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
添加完畢保存退出
source /etc/profile

[root@localhost jdk1.7.0]# java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
[root@localhost jdk1.7.0]# echo $JAVA_HOME

/usr/java/jdk1.7.0

這個時候就大功告成了

相關文章
相關標籤/搜索