如何在Mac OS X上获得JDK 1.5 [英] How to get JDK 1.5 on Mac OS X
问题描述
我必须为仍在运行JDK 1.5的遗留应用程序编写一些代码。不幸的是,看起来OS X实际上并没有安装1.5 JDK;它只链接到1.6:
I've got to write some code for a legacy application that is still running JDK 1.5. Unfortunately, it looks like OS X doesn't actually have a 1.5 JDK installed; it just links to 1.6:
/System/Library/Frameworks/JavaVM.framework/Versions $ ls -l
lrwxr-xr-x 1 root wheel 5 Apr 26 11:53 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Feb 11 15:33 1.3.1
lrwxr-xr-x 1 root wheel 10 Apr 26 11:53 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Apr 26 11:53 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Apr 26 11:53 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Apr 26 11:53 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 5 Apr 26 11:53 1.6 -> 1.6.0
drwxr-xr-x 7 root wheel 238 Apr 26 11:53 1.6.0
drwxr-xr-x 8 root wheel 272 Apr 26 11:53 A
lrwxr-xr-x 1 root wheel 1 Apr 26 11:53 Current -> A
lrwxr-xr-x 1 root wheel 3 Apr 26 11:53 CurrentJDK -> 1.6
听起来像是来自 http://developer.apple.com/java/faq/ Java是操作系统更新的一部分......我在 Mac OS X v10.6.3 (Snow Leopard)。有没有办法在这个操作系统版本上安装一个实际的1.5 JDK?
It sounds like from http://developer.apple.com/java/faq/ that Java is part of the OS update...I'm on Mac OS X v10.6.3 (Snow Leopard). Is there a way to get an actual 1.5 JDK installed on this OS version?
或者在我能做之前我是否需要尝试找到旧版本的OS X这项工作?
Or do I need to try and find an old version of OS X before I can do this work?
推荐答案
如果您在Eclipse或其他IDE中编写代码,您应该能够将其配置为目标1.5合规。
If you're writing code in Eclipse or potentially some other IDE, you should be able to configure it to target 1.5 compliance.
如果您直接使用javac,您可以尝试 -source 1.5
和/或 -target 1.5
javac选项,这可能足以满足您的需求? 1.6 JDK应该能够生成符合1.5的代码。
If you are using javac directly, you could try the -source 1.5
and/or -target 1.5
javac options, which may be sufficient for what you're doing? The 1.6 JDK should be able to produce 1.5-compliant code.
这篇关于如何在Mac OS X上获得JDK 1.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!