【问题标题】:Install JDK 1.5 in OSX 10.10 Yosemite在 OSX 10.10 Yosemite 中安装 JDK 1.5
【发布时间】:2015-06-14 15:24:18
【问题描述】:

我使用 OS X Yosemite (10.10.2),我必须使用 JDK 1.5 来开发遗留应用程序。我发现this 帖子是指this 在 Lion 和 Mavericks 中安装 JDK 4、5、6 的脚本。在 cmets 我发现了这两行

/usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumFrameworkVersion 14.*.*" ./Resources/Info.plist
/usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumSystemVersion "$osx_version".*" ./Resources/Info.plist

必须改变

/usr/libexec/PlistBuddy -c "Delete :JavaVM:JVMMaximumFrameworkVersion" ./Resources/Info.plist
/usr/libexec/PlistBuddy -c "Delete :JavaVM:JVMMaximumSystemVersion" ./Resources/Info.plist

实现与优胜美地的兼容性。我运行了这个脚本,这是我的 /System/Library/Frameworks/JavaVM.framework/Versions 目录的内容

lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.4 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.4.2 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10  9 apr 11:01 1.5 -> ./1.5.0_30
lrwxr-xr-x  1 root  wheel   10  9 apr 11:01 1.5.0 -> ./1.5.0_30
drwxr-xr-x  9 root  wheel  306  9 apr 11:01 1.5.0_30
lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.6 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.6.0 -> CurrentJDK
drwxr-xr-x  7 root  wheel  238  8 apr 14:36 A
lrwxr-xr-x  1 root  wheel    1  8 apr 14:36 Current -> A

在 Eclipse 首选项 Java->Installed JREs->Execution Environments 中,没有任何 JRE 1.5

这可能是我无法在 Java 5 中构建项目的原因,因为我得到了错误:

Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.

在 Eclipse 首选项中已安装的 JRE - JSE-1.5 指的是正确的路径

在项目首选项Java Build Path中包含J2SE-1.5

并且项目首选项中的 Java Compiler 设置也正确。

这是/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30目录的内容

这个帖子引用了我的previous 帖子。

【问题讨论】:

标签: java eclipse macos osx-yosemite jdk1.5


【解决方案1】:

我认为您的问题的解决方案可能是in this question

Eclipse 是一个功能强大的 IDE,因此可以让 1.6/1.7/1.8 JRE 像 1.5 JRE 一样运行。我不熟悉使用它,但它看起来比下载一个完全不同的 JDK 容易得多。

要更改编译器合规级别,请转至您的Project Settings -> Java Compiler

取消勾选Use compliance from execution environment并确保勾选Use default compliance settings,并且旁边的框设置为1.5

然后您可以改回使用您的 JDK 1.7。

请让我知道这是否有效,因为如果这没有帮助,我可以发布一个为您安装新 JRE 的答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-07-28
    • 2015-01-04
    • 2014-12-24
    • 1970-01-01
    • 2015-02-24
    • 2014-12-15
    • 2015-05-24
    • 1970-01-01
    相关资源
    最近更新 更多