fedora19安装jdk



1.下载安装包 去oracle下载jdk-7u45-linux-i586.rpm

2. 更改权限 #chmod 777jdk-7u45-linux-i586.rpm

3. 安装 #rpm -ivh jdk-7u45-linux-i586.rpm

默认安装在/usr/java/jdk1.7.0_45

4.创建链接代替默认的GCJ

#cd /usr/bin

[root@hman bin]# ls -s -f /usr/java/jdk1.7.0_45/jre/bin/java
/usr/java/jdk1.7.0_45/jre/bin/java
[root@hman bin]# ls -s -f /usr/java/jdk1.7.0_45/bin/javac
/usr/java/jdk1.7.0_45/bin/javac
[root@hman bin]# ls -s -f /usr/java/jdk1.7.0_45/bin/javaws
/usr/java/jdk1.7.0_45/bin/javaws
[root@hman bin]# ls -s -f /usr/java/jdk1.7.0_45/bin/javadoc
/usr/java/jdk1.7.0_45/bin/javadoc

 

5.修改/etc/bashrc文件

加入下面4行

export JAVA_HOME=/usr/java/jdk1.7.0_45

export JAVA_BIN=$JAVA_HOME/bin

export PATH=$PATH:$JAVA_HOME/bin

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

 

[root@hman hjg]# alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_45/bin/java 10000
[root@hman hjg]# alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_45/bin/javac 10000
[root@hman hjg]# alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_45/bin/javaws 10000
[root@hman hjg]# /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.i386/jre/bin/java
   2           /usr/java/jdk1.7.0_45/bin/java

Enter to keep the current selection[+], or type selection number: 2
[root@hman hjg]# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)
[root@hman hjg]# javac -version
javac 1.7.0_45

 

你可能感兴趣的:(fedora)