简体   繁体   English

Eclipse没有打开jvm过时的mac

[英]Eclipse not opening jvm out of date mac

I am on a mac and try to program java with newer versions of eclipse, but they are not working. 我在Mac上并尝试使用较新版本的eclipse编写java,但它们无法正常工作。 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." 旧版本的eclipse正在运行,但我最近安装了Eclipse Luna,当我打开它时,它说:“JVM的1.6.0_31版本不适用于此产品。版本:需要1.7或更高版本。” But I have the newest version of java installed. 但我安装了最新版本的java。 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. 我安装了最新版本的JDK,如果我没弄错,JVM是Java虚拟机,但我不知道如何更新它。 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. 我对java有所了解,但是我对JVM这样的东西很开心,所以请在解释答案时尽可能具体。 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 我在发布之前在这个网站上搜索过,一个类似问题的答案就是输入

 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. 所以请帮助,我不知道该怎么做。

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 -version command.. 使用java -version命令验证更改..

Firstly, you need to verify that you've installed the 1.7 or newer JVM. 首先,您需要验证是否已安装1.7或更新的JVM。 To do this you do: 为此,您可以:

/usr/libexec/java_home --verbose

This command is built-in to mac OS X, and will list all the known java environments available. 此命令内置于mac OS X,并将列出所有可用的已知Java环境。 If you don't see a 1.7 VM in the list then it's not been installed correctly. 如果列表中没有看到1.7 VM,则表示未正确安装。

Secondly, you need to ensure that the version of Eclipse you downloaded is compatible with the JVM. 其次,您需要确保您下载的Eclipse版本与JVM兼容。 For example, I have the following JDKs installed: 例如,我安装了以下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. 这意味着我可以使用带有1.6,1.7和1.8 VM的64位( x86_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. 这意味着我只能在1.6 VM上使用32位( i386 )版本的eclipse,因为这是唯一具有32位JDK的版本。

The Eclipsepedia installation page indicates that a 1.7 JDK/JRE is required for most of the Luna package downloads based on Eclipse 4.4 (extracted from page). Eclipsepedia安装页面表明, 基于Eclipse 4.4 (从页面中提取)的大多数Luna软件包下载需要 1.7 JDK / JRE。

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. 要确定您下载的eclipse实例的32 / 64bit版本,请在终端上转到eclipse安装目录。 In the same directory that has directories called: Eclipse.app , configuration , plugins there is a symlink to the eclipse binary. 在具有名为Eclipse.appconfigurationplugins目录的同一目录中,有一个eclipse二进制文件的符号链接。 Run file eclipse and it will tell you the mode that it runs in; 运行file eclipse ,它会告诉你它运行的模式; and if you get x86_64 then it's a 64bit version, if you get i386 then it's a 32bit version. 如果你得到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

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 它为我工作

I think the Java 1.6 version that you've on your system could be Apple's Java runtime. 我认为您系统中的Java 1.6版本可能是Apple的Java运行时。 Starting Java 7, Apple has decided not to make their own port, you need to get it from Oracle. 从Java 7开始,Apple已经决定不制作自己的端口,你需要从Oracle获得它。

It seems that there could be something wrong with your installation of Java. 您的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 -v first. 您可以尝试删除现有的Java安装,然后可以从Oracle安装Java 7的新副本,然后尝试先运行java -v If that works well, then you can set JAVA_HOME and go further. 如果效果很好,那么你可以设置JAVA_HOME并进一步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM