java1.7 openjdk 64位,在另一个目录中安装Java 1.7 OpenJDK (Install Java 1.7 OpenJDK in another directory)...

The basic problem not mentioned by OP is that Java7 is considered obsolete; Java8 has been current since last spring. So, in the background we might assume that OP wants to put Java7 in a directory under /opt named for the given version.

It would be nice if the OpenJDK package were relocatable. The possibility of relocatable packages is mentioned here and there:

It is not: I was curious, and tried using the --installroot option of dnf ("same" as yum, but again, the latter is deprecated on Fedora22).

If you install Java7 on a system where you already have Java8, your package system may change the symbolic links for /usr/bin/java and/or /etc/alternatives/java to point to the newest install of Java.

Aside from that, it seems that the various systems where you might want to install OpenJDK have packaged it to avoid conflict.

With Fedora, for instance, the package java-1.7.0-openjdk-headless contains Java7's JRE. (If you need the development package, that would be java-1.7.0-openjdk-devel):

As suggested, you could make a symbolic link from /opt to the location in /usr/lib/jvm where your Java resides. Your PATH would have to have /opt/java1.7/bin and/or /opt/java1.7/jre/bin, depending on whether you want the development- or runtime-packages.

You should not construct the symbolic link in a manner that would eliminate the /bin leaf. The reason for this is that the executables are built using the rpath option so that the linker can find the required Java shared library based on the location of the executable. Incidentally, that is why the symbolic link works. Doing objdump -axh on the java executable shows (among other things) something like this:

Dynamic Section:

NEEDED libpthread.so.0

NEEDED libz.so.1

NEEDED libjli.so

NEEDED libdl.so.2

NEEDED libc.so.6

SONAME lib.so

RPATH $ORIGIN/../lib/amd64/jli:$ORIGIN/../lib/amd64

Because of this use of rpath, it would be possible to move the entire directory from /usr/lib/jvm to /opt and rename it in that location. Doing this has the drawback that package updates would not work, but it would succeed in "installing" Java7 in that location.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
http://www.cnblogs.com/zengkefu/p/5633342.html OpenJDK和Sun/OracleJDK 区别 与联系 首先要先明确之间,以及OpenJDK 6、OpenJDK 7、OpenJDK 7u和OpenJDK 8等项目之间是什么关系,这有助于确定接下来编译要使用的JDK版本和源码分支。 从前面介绍的Java发展史我们了解到OpenJDK是Sun在2006年末把Java开源而形成的项目,这里的“开源”是通常意义上的源码开放形式,即源码是可被复用的,例如IcedTea、UltraViolet都是从OpenJDK源码衍生出的发行版。但如果仅从“开源”字面意义(开放可阅读的源码)上看,其实Sun自JDK 1.5之后就开始以Java Research License(JRL)的形式公布过Java源码,主要用于研究人员阅读(JRL许可证的开放源码至JDK 1.6 Update 23为止)。把这些JRL许可证形式的Sun/OracleJDK源码和对应版本的OpenJDK源码进行比较,发现除了文件头的版权注释之外,其余代码基本上都是相同的,只有字体渲染部分存在一点差异,Oracle JDK采用了商业实现,而OpenJDK使用的是开源的FreeType。当然,“相同”是建立在两者共有的组件基础上的,Oracle JDK还会存在一些Open JDK没有的、商用闭源的功能,例如从JRockit移植改造而来的Java Flight Recorder。预计以后JRockit的MissionControl移植到HotSpot之后,也会以Oracle JDK专有、闭源的形式提供。 Oracle的项目发布经理Joe Darcy在OSCON 2011上对两者关系的介绍也证实了OpenJDK 7和Oracle JDK 7在程序上是非常接近的,两者共用了大量相同的代码(如下图,注意图提示了两者共同代码的占比要远高于图形上看到的比例),所以我们编译的OpenJDK,基本上可以认为性能、功能和执行逻辑上都和官方的Oracle JDK是一致的。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值