我安装了Java 7,但是Eclipse坚持说1.6不适合这个产品 [英] I installed Java 7 but Eclipse keep saying that 1.6 is not suitable for this product

查看:102
本文介绍了我安装了Java 7,但是Eclipse坚持说1.6不适合这个产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS X 10.9.4上使用最新版本的Eclipse Luna。每当我尝试打开Eclipse时,它表示版本1.6.0_65的JVM不适合此产品,需要1.7或更高版本。我安装了java 7(JRE,我不需要JDK),但是我仍然遇到同样的错误。我试过java -version,输出是java version 1.6.0_65。我可以看到我的系统首选项上的java图标。我也重新启动了我的Mac,看看是否有效,但也没有帮助。我在谷歌搜索,有些人建议其他用户更改Eclipse.ini文件,说明不清楚,我是一个java初学者,所以我不知道在哪里和什么编辑。任何一步一步的说明将不胜感激。

解决方案

解决问题的一个潜在解决方案可能是卸载Java6(由Apple自己提供),并且只有在系统中安装了Java7 。这仅适用于您没有任何迫切需要安装旧Java6版本的应用程序的情况。



要删除类似Apple的Java6安装程序,请打开一个终端:


sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk


此步骤之后,您应该只有Java7 Oracle在您的系统中安装。要验证,请打开另一个终端并执行以下操作:


java -version


它应该显示java version1.7.0_XX,其中XX是Java7安装的当前更新版本,如果没有:继续下一步。



重新定义JAVA_HOME变量(以支持Eclipse和其他开发工具...),这有助于检测您的系统中活动Java安装位置。打开终端,(注意:首先替换XX!):


sudo rm / Library / Java / Home



sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_XX.jdk/Contents/Home / Library / Java / Home


之后,Eclipse的全新安装应该会检测到您的系统中的Java7,并且应该使用此版本开箱即可。您可以修改已安装的Eclipse,以便通过在Eclipse中导航来使用此安装:


首选项 - > Java - >已安装的JRE。然后删除旧的Java6系统条目,并添加新路径(见上文),名称为Java7。



I'm using latest version of Eclipse Luna on Mac OS X 10.9.4. Whenever I try to open the Eclipse it says "version 1.6.0_65 of the JVM is not suitable for this product, version 1.7 or greater is required". I installed java 7 (JRE, I don't need JDK) but still I'm getting the same error. I tried java -version and the output was "java version 1.6.0_65". I can see the java icon on my system preferences. I also restarted my Mac to see if that works but that doesn't help either. I searched on google and some people suggesting other users to change Eclipse.ini file, the instructions wasn't clear and I'm a java beginner so I've no idea where and what to edit. Any step by step instructions will be appreciated.

解决方案

A potential solution to your problem might be to uninstall Java6 (provided by Apple itself) and only have Java7 installed in your system. This only applies in case you have no applications that desperately need the old Java6 version to be installed.

To remove the Apple-like Java6 installation open a Terminal and:

sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

After this step you should only have Java7 by Oracle installed in your system. To verify, open another terminal and do a:

java -version

It should display something like "java version "1.7.0_XX" where XX is the current update version of the Java7 installation. If not: proceed with the next step.

Redefine the JAVA_HOME variable (to support IDEs like Eclipse and other developer tools...), which helps detecting where the "active" Java installation is situated in your system. Open a terminal and (Note: replace XX first!):

sudo rm /Library/Java/Home

sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_XX.jdk/Contents/Home /Library/Java/Home

Afterwards, a fresh installation of Eclipse should detect Java7 in your system and should work with this version out of the box. You can modify an installed Eclipse to use this installation by navigating in Eclipse to:

Preferences -> Java -> Installed JREs. Then remove the old Java6 system entry AND add new path (see above) with the name Java7.

这篇关于我安装了Java 7,但是Eclipse坚持说1.6不适合这个产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆