Java Eclipse 不打开 jvm 过时的 mac

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24971977/
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-08-14 16:05:10  来源:igfitidea点击:

Eclipse not opening jvm out of date mac

javaeclipsemacosjvm

提问by RothX

I am on a mac and try to program java with newer versions of eclipse, but they are not working. Old versions of eclipse are working, but I recently installed Eclipse Luna and when I open it, it says: "Version 1.6.0_31 of the JVM is not suitable for this product. Version: 1.7 or greater is required." But I have the newest version of java installed. I installed the newest version of the JDK, and if I'm not mistaken, JVM is Java virtual machine but I don't know how to update that. I am expirienced with java, however I am beginner to how stuff like the JVM works, so please try to be as specific as possible when explaining the answer. Also explain why it works and why it wasn't working before. I searched on this site before posting and one answer to a similar problem was to type

我在 mac 上并尝试使用较新版本的 eclipse 对 java 进行编程,但它们不起作用。旧版本的 eclipse 可以工作,但我最近安装了 Eclipse Luna,当我打开它时,它说:“JVM 的 1.6.0_31 版本不适合该产品。版本:1.7 或更高版本是必需的。” 但是我安装了最新版本的java。我安装了最新版本的 JDK,如果我没记错的话,JVM 是 Java 虚拟机,但我不知道如何更新它。我对 Java 很熟悉,但是我是 JVM 之类的东西如何工作的初学者,所以在解释答案时请尽量具体。还要解释为什么它起作用以及为什么它以前不起作用。我在发帖之前在这个网站上搜索过类似问题的一个答案是输入

 export JAVA_HOME=/usr/libexec/java_home -v 1.7

into terminal, but terminal gave me the error:

进入终端,但终端给了我错误:

 -bash: export: `/usr/libexec/java_home': not a valid identifier
 -bash: export: `-v': not a valid identifier
 -bash: export: `1.7': not a valid identifier

So please help, I don't know what to do.

所以请帮忙,我不知道该怎么办。

采纳答案by Petesh

Firstly, you need to verify that you've installed the 1.7 or newer JVM. To do this you do:

首先,您需要验证您是否安装了 1.7 或更新的 JVM。为此,您可以:

/usr/libexec/java_home --verbose

This command is built-in to mac OS X, and will list all the known java environments available. If you don't see a 1.7 VM in the list then it's not been installed correctly.

此命令是 mac OS X 内置的,将列出所有已知的可用 java 环境。如果您在列表中没有看到 1.7 虚拟机,则说明它没有正确安装。

Secondly, you need to ensure that the version of Eclipse you downloaded is compatible with the JVM. For example, I have the following JDKs installed:

其次,您需要确保您下载的 Eclipse 版本与 JVM 兼容。例如,我安装了以下 JDK:

1.8.0_05, x86_64:   "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
1.7.0_55, x86_64:   "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
1.6.0_65-b14-462, x86_64:   "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home
1.6.0_65-b14-462, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home

This means that I can use a 64bit (x86_64) version of eclipse with a 1.6, 1.7 and 1.8 VM.

这意味着我可以x86_64在 1.6、1.7 和 1.8 虚拟机上使用 64 位 ( ) 版本的 eclipse。

This means that I can use a 32bit (i386) version of eclipse with the 1.6 VM only because that is the only version that has a 32bit JDK.

这意味着我可以将 32 位 ( i386) 版本的 eclipse 与 1.6 VM 一起使用,因为这是唯一具有 32 位 JDK 的版本。

The Eclipsepedia installation pageindicates that a 1.7 JDK/JRE is required for most of the Luna package downloads based on Eclipse 4.4(extracted from page).

所述Eclipsepedia安装页面指示1.7 JDK / JRE是最需要的基于Eclipse 4.4露娜包下载的(从页面中提取)。

So, make sure that you're using the 64bit downloads.

因此,请确保您使用的是 64 位下载。

To determine the 32/64bit version of the eclipse instance that you downloaded, at a terminal go to the directory of the eclipse installation. In the same directory that has directories called: Eclipse.app, configuration, pluginsthere is a symlink to the eclipsebinary. Run file eclipseand it will tell you the mode that it runs in; and if you get x86_64then it's a 64bit version, if you get i386then it's a 32bit version.

要确定您下载的 eclipse 实例的 32/64 位版本,请在终端上转到 eclipse 安装目录。在具有名为: Eclipse.app, 的目录的同一目录中configurationplugins有一个指向eclipse二进制文件的符号链接。运行file eclipse它会告诉你它运行的模式;如果你得到x86_64那么它是一个 64 位版本,如果你得到i386那么它是一个 32 位版本。

64bit:

64位:

$ file eclipse
eclipse: Mach-O 64-bit executable x86_64

32bit:

32位:

$ file eclipse
eclipse: Mach-O 32-bit executable i386

回答by Swapnil

I think the Java 1.6 version that you've on your system could be Apple's Java runtime. Starting Java 7, Apple has decided not to make their own port, you need to get it from Oracle.

我认为您系统上的 Java 1.6 版本可能是 Apple 的 Java 运行时。从 Java 7 开始,Apple 决定不制作自己的端口,您需要从 Oracle 获取它。

It seems that there could be something wrong with your installation of Java. You can try removing existing Java installation(s) and you can install fresh copy of Java 7 from Oracle and then try running java -vfirst. If that works well, then you can set JAVA_HOMEand go further.

您的 Java 安装似乎有问题。您可以尝试删除现有的 Java 安装,您可以从 Oracle 安装 Java 7 的新副本,然后先尝试运行java -v。如果效果很好,那么您可以设置JAVA_HOME并进一步。

回答by dpace

I had the same issue for quite a while. This helped in my case. Run the following in your terminal..

我有同样的问题很长一段时间。这对我有帮助。在终端中运行以下命令..

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

verify the change with java -versioncommand..

使用java -version命令验证更改..

回答by Atreya Rath

After installing the latest java SE run

安装最新的java SE后运行

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

it Worked for me

它对我有用