我使用 OS X Yosemite (10.10.2),并且必须使用 JDK 1.5 进行遗留应用程序开发。我发现this帖子指的是this在 Lion 和 Mavericks 中安装 JDK 4、5、6 的脚本。在评论中我发现这两行
/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
以实现与 Yosemite 的兼容性。我运行了这个脚本,这是我的内容/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->安装的JRE->执行环境,没有任何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 构建路径包含J2SE-1.5
and Java编译器在项目首选项中也设置正确。
这是内容/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30
目录
该线程引用了我的previous post.