Eclipse 4.2、Mac OS X 10.8 (ML) 和 Java 6

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11919004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:48:10  来源:igfitidea点击:

Eclipse 4.2, Mac OS X 10.8 (ML), and Java 6

eclipsemacosinstall

提问by jww

I'm trying to run Eclipse 4.2 (latest from website: eclipse-SDK-4.2-macosx-cocoa-x86_64) on Mac OS X 10.8 (Mountain Lion).

我正在尝试在 Mac OS X 10.8(Mountain Lion)上运行 Eclipse 4.2(来自网站的最新版本:eclipse-SDK-4.2-macosx-cocoa-x86_64)。

I have Java 7 installed, but I keep getting prompted to install Java 6. When I choose to forgo the install by clicking "Not Now", Eclipse exits.

我安装了 Java 7,但一直提示我安装 Java 6。当我通过单击“Not Now”选择放弃安装时,Eclipse 退出。

$ java -version
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

$ whereis java
/usr/bin/java

Any ideas on how to get Eclipse to work with the latest version of Java? README is lacking any useful information (and even claims Eclipse was tested with Java 7 on some platforms).

关于如何让 Eclipse 与最新版本的 Java 一起工作的任何想法?README 缺乏任何有用的信息(甚至声称 Eclipse 在某些平台上使用 Java 7 进行了测试)。



UPDATE: Running sudo /Applications/.Eclipse/Eclipse.app/Contents/MacOS/eclipseworks fine. After running under sudo and then switching back to lowly me with /Applications/.Eclipse/Eclipse.app/Contents/MacOS/eclipseresults in a lock file error (permission denied).

更新:运行sudo /Applications/.Eclipse/Eclipse.app/Contents/MacOS/eclipse正常。在 sudo 下运行然后切换回lowly me/Applications/.Eclipse/Eclipse.app/Contents/MacOS/eclipse导致锁定文件错误(权限被拒绝)。

It appears I have two problems:

看来我有两个问题:

  • Running through icon click results in "Need Java 6"

  • Running from command line results in "Permission Denied"

  • 运行图标单击导致“需要 Java 6”

  • 从命令行运行导致“权限被拒绝”



UPDATE: It appears to be more junk from Cupertino:

更新:库比蒂诺似乎更垃圾:

Apple Radar: 12082976

苹果雷达:12082976

Here's the text that Apple wants to hide from the world:

以下是 Apple 想要向世人隐藏的文字:

I purchased a new Mac Book Pro. I immediately upgraded to Mountain Lion. I installed Java 7 from Sun [Oracle]:

我购买了新的 Mac Book Pro。我立即升级到山狮。我从 Sun [Oracle] 安装了 Java 7:

$ java -version java version "1.7.0_05" Java(TM) SE Runtime Environment (build 1.7.0_05-b06) Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

$ java -version java version "1.7.0_05" Java(TM) SE Runtime Environment (build 1.7.0_05-b06) Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03,混合模式)

$ whereis java /usr/bin/java

$ whereis java /usr/bin/java

$ /usr/libexec/java_home /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

$ /usr/libexec/java_home /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

When I attempt to run the Java Preferences (in /Applications/Utilities) and Eclipse, I get prompted to install Java (see attachment).

当我尝试运行 Java 首选项(在 /Applications/Utilities 中)和 Eclipse 时,系统会提示我安装 Java(请参阅附件)。

This outdated article was no help (adding environment.plist): https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html. I thought the problem might be $JAVA_HOME was not set, but I was wrong.

这篇过时的文章没有帮助(添加 environment.plist):https: //developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html。我认为问题可能是 $JAVA_HOME 没有设置,但我错了。

I think I got more useful information from Stack Overflow rather than the vendor (Apple), but its still not solved. https://apple.stackexchange.com/questions/58203/mountain-lion-with-java-7-onlyand https://apple.stackexchange.com/questions/57986/multiple-java-versions-support-on-os-x-and-java-home-location.

我想我从 Stack Overflow 而不是供应商(Apple)那里得到了更多有用的信息,但仍然没有解决。https://apple.stackexchange.com/questions/58203/mountain-lion-with-java-7-onlyhttps://apple.stackexchange.com/questions/57986/multiple-java-versions-support-on- os-x-and-java-home-location

Please fix this. I spends thousands on Apple hardware and hundreds on Apple software, and this sort of thing is not acceptable. I have personally wasted hours on this issue, as have others. How can the Apple QA department miss another gapping hole?

请解决这个问题。我在苹果硬件上花费了数千美元,在苹果软件上花费了数百美元,这种事情是不可接受的。我个人在这个问题上浪费了几个小时,其他人也是如此。Apple QA 部门怎么会错过另一个漏洞?

回答by Ashutosh Jindal

From here.

这里开始

JDK 7 will be installed under /Library/Java/JavaVirtualMachines/1.7.0.jdk, JDK 6 under /System/Library/Java/JavaVirtualMachines.

To trick OS X to accept Java 7 instead of proposing to install Java 6 a simple symlink is enough:

    sudo mkdir /System/Library/Java/JavaVirtualMachines
    sudo su ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

Most Java Programms will run with this little hack without the need to install Java 6. 

Note that the OP in the above question specifically talks about Eclipse not working with Java 7.

请注意,上述问题中的 OP 专门讨论了 Eclipse 不适用于 Java 7。

Also thismight be worthwhile read.

另外可能是值得读。

回答by Music Monkey

I'm rather embarrassed but one of my students helped me solve this issue.

我很尴尬,但我的一个学生帮我解决了这个问题。

If you have Java 7 installed then you should be using the 64 bit version of Eclipse. I had downloaded the 32 bit version and it was asking me to install Java 6 when I had version 7 installed. Downloaded the 64bit version and it works like a dream. I run Mac os 10.8

如果您安装了 Java 7,那么您应该使用 64 位版本的 Eclipse。我已经下载了 32 位版本,当我安装了版本 7 时,它要求我安装 Java 6。下载了 64 位版本,它像做梦一样工作。我运行 Mac os 10.8

回答by Xavier Arias Botargues

Installing this update from apple fixed it for me: http://support.apple.com/kb/DL1572

从苹果安装此更新为我修复了它:http: //support.apple.com/kb/DL1572

Note that's the update that's trying to install automatically.

请注意,这是尝试自动安装的更新。

回答by Hyman Zhang

Can you imagine that? You have to install a JDK 1.6 to get eclipse ran properly, even if you already have jdk 1.7 installed, and set the JAVA_HOME properly.

你能想象吗?您必须安装 JDK 1.6 才能正常运行 eclipse,即使您已经安装了 jdk 1.7,并正确设置了 JAVA_HOME。

To resolve your issue, you just need to download the jdk1.6 from http://support.apple.com/kb/DL1572?viewlocale=en_US, and install it, later you will be able to run eclipse, and you can set the JAVA_HOME to JDK1.7, and you will be able to find the JDK1.7 from eclipse "Preferences".

要解决您的问题,您只需要从http://support.apple.com/kb/DL1572?viewlocale=en_US下载 jdk1.6并安装它,稍后您就可以运行 eclipse,您可以设置将 JAVA_HOME 转换为 JDK1.7,您将能够从 Eclipse 的“首选项”中找到 JDK1.7。

回答by user827992

The MAC OS offers the Java Preferencestool under Applications.

MAC OS在Applications下提供了Java Preferences工具。

If you don't have this tool you can edit the eclipse.ini and manually specify the JVM that you want to use.

如果您没有此工具,您可以编辑 eclipse.ini 并手动指定您要使用的 JVM

Of course remember that Java 7 is the only Java official release for MAC and is probably not the best for developing applications. I would go for the 1.6 release but you are forced with this one due to OS restrictions if you want to stick with the standard.

当然请记住,Java 7 是唯一用于 MAC 的 Java 官方版本,可能不是开发应用程序的最佳版本。我会选择 1.6 版本,但如果你想坚持标准,你会因为操作系统限制而被迫使用这个版本。