如何在Fedora 17 18 19 20 21 22 23 系统中安装 openjdk 1.6 与 1.7 1.8 共存

首先在高版本Fedora中,没有java-openjdk-1.6包,需要在网上下载,比如CentOS 7中的java-openjdk-1.6包:java-1.6.0-openjdk-1.6.0.36-1.13.8.1.el7_1.x86_64.rpm,实测可在Fedora 20中安装。

以下为转载,主要注意安装提示“java-1.7.0-openjdk obsoletes java-1.6.0-openjdk”时,使用rpm -nodeps就可以了,然后还需要:update-alternatives --config java和update-alternatives --config javac,指定1.6版本:

yum install java-1.6.0-openjdk --releasever=16 --nogpgcheck

(--nogpgcheck because yum complains of not having the key for Fedora 16, maybe there are better ways to solve this)

But this shows, that java-1.7.0-openjdk obsoletes java-1.6.0-openjdk and skips installation. And it shows that the packagexorg-x11-fonts-Type1 is needed. So I did

yum install xorg-x11-fonts-Type1

and then I used the openjdk package which yum downloaded but refused to install because of theobsoletes warning

rpm --nodeps -ihv /var/cache/yum/x86_64/16/updates/packages/java-1.6.0-openjdk-1.6.0.0-68.1.11.5.fc16.x86_64.rpm

(--nodeps for overriding the obsoletes warning)

Now I have both java 1.6 and java 1.7 on my system. Java 1.7 is my default. And Java 1.6 is in/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java.

PS: There won't be any conflicts when you install both 1.7 and 1.6. The reason for removing 1.6 from Fedora 17 was, that OpenJDK6 willno longer get security updates after November 2012.

PS: Please vote up, if you liked my answer.


#update-alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79-2.5.5.0.fc20.x86_64/jre/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: 2


# update-alternatives --config javac

There is 1 program that provides 'javac'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79-2.5.5.0.fc20.x86_64/bin/javac

Enter to keep the current selection[+], or type selection number:  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值