OS X中的Eclipse使用与CLI不同的Java版本 [英] Eclipse in OS X uses different version of Java than CLI

查看:113
本文介绍了OS X中的Eclipse使用与CLI不同的Java版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在控制台中输入 java -version 时,我得到 java版本1.8.0_05。软链接 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK 指向 /Library/Java/JavaVirtualMachines/jdk1.8.0_05。 JDK /内容。在java首选项窗口中,唯一列出的Java版本是1.8。 JAVA_HOME设置为 /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home

When I type java -version in the console I get java version "1.8.0_05". The soft link /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK points to /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents. In the java preferences window, the only listed version of Java is 1.8. JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home.

但是,当我尝试运行Eclipse.app时,我收到错误:版本1.6.0_65的JVM不适合此产品。版本:需要1.7或更高版本。

However, when I try to run Eclipse.app, I get the error: Version 1.6.0_65 of the JVM is not suitable for this product. Version: 1.7 or greater required.

我相信它试图使用 / System / Library / Java / JavaVirtualMachines ,该目录中唯一的版本是 1.6.0.jdk

I believe it is trying to use /System/Library/Java/JavaVirtualMachines and in that directory the only version is 1.6.0.jdk.

我可以让eclipse使用正确的Java版本吗?

How can I get eclipse to use the correct version of Java?

推荐答案

下载64位版本的Eclipse,而不是32-

Download the 64-bit version of Eclipse instead of the 32-bit version.

原因是Eclipse包含原生机器代码(对于GUI),这就是为什么有32位和64位版本的Eclipse,这显然需要相应的Java版本。苹果最初创建的这两个版本高达Java 6,但是Oracle只创建了一个64位版本(对旧机器的所有者感到沮丧)。所以,如果你下载一个32位版本的Eclipse,它只会运行一个苹果JVM,这显然是太老了(这让我很惊讶 - 我以为Java 6仍然支持Eclipse 4.4)

The reason is that Eclipse contains native machine code (for the GUI) which is why there is both a 32-bit and 64-bit version of Eclipse, and this explicitly require the corresponding Java version. Originally Apple created both versions up to Java 6, but Oracle only creates a 64-bit version (much to the dismay of owners of older machines). So, if you download a 32-bit version of Eclipse it will only run with an Apple JVM, which apparently is too old (which surprise me - I thought Java 6 was still supported for Eclipse 4.4)

这篇关于OS X中的Eclipse使用与CLI不同的Java版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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