在OSX 10.10优胜美地安装JDK 1.5 [英] Install JDK 1.5 in OSX 10.10 Yosemite
问题描述
我使用OS X优胜美地(10.10.2),我必须使用JDK 1.5进行遗留应用开发。我发现 post。
认为您的问题的解决方案可能是此问题。
Eclipse是一个强大的IDE,因此可以让1.6 / 1.7 / 1.8 JRE运行,就好像是1.5 JRE一样。我不熟悉使用它,但它看起来比下载一个完全不同的JDK容易得多。
要更改编译器合规性级别,请转到您的项目设置 - > Java编译器
Untick 使用执行环境中的合规性
并确保使用默认合规性设置
被勾选,并且该框旁边的框设置为 1.5
。
然后您可以转回使用您的JDK 1.7。
请让我知道这是否有效,因为我可以发布一个解决方案,为您安装一个新的JRE,如果这没有帮助。
I use OS X Yosemite (10.10.2) and I have to use JDK 1.5 for legacy application development. I found this post which refers to this script to install JDK 4,5,6 in Lion and Mavericks. In comments I found this two lines
/usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumFrameworkVersion 14.*.*" ./Resources/Info.plist
/usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumSystemVersion "$osx_version".*" ./Resources/Info.plist
have to be changed by
/usr/libexec/PlistBuddy -c "Delete :JavaVM:JVMMaximumFrameworkVersion" ./Resources/Info.plist
/usr/libexec/PlistBuddy -c "Delete :JavaVM:JVMMaximumSystemVersion" ./Resources/Info.plist
to achieve compatibility with Yosemite. I ran this script and this is content of my /System/Library/Frameworks/JavaVM.framework/Versions
directory
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
In Eclipse preferences Java->Installed JREs->Execution Environments, there is not any JRE 1.5
and probably this is the reason why I cannot build projects in Java 5, because I get errors:
Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.
In Eclipse preferences Installed JREs - JSE-1.5 refers to correct path
In project preferences Java Build Path contains J2SE-1.5
and Java Compiler in project preferences is set correctly as well.
This is content of /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30
directory
This thread refers to my previous post.
I think the solution to your problem might be in this question.
Eclipse is a powerful IDE, and as such can tell a 1.6/1.7/1.8 JRE to run as if it was a 1.5 JRE. I am not familiar with using this, but it looks a lot easier than downloading an entirely different JDK.
To change the compiler compliance level, go to your Project Settings -> Java Compiler
Untick Use compliance from execution environment
and ensure that Use default compliance settings
is ticked, and that the box alongside that is set to 1.5
.
Then you can change back to using your JDK 1.7.
Please let me know if this worked, as I can post an answer that walks through installing a new JRE for you, if this hasn't helped.
这篇关于在OSX 10.10优胜美地安装JDK 1.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!