我正在尝试使用Eclipse进行Android开发。我在尝试运行Eclipse时遇到了这个问题,因为几分钟前刚刚安装了4.2版本。

在第一次尝试在没有任何参数指定Java VM的情况下启动Eclipse之后,我得到了一条错误消息,说它在Eclipse文件夹中找不到一个名为javaw.exe的Java VM,所以我找到了Java安装的位置,并在快捷方式的目标中将该位置指定为参数。现在我得到一个不同的错误,Java已经启动,但返回退出代码=13。

类似的问题似乎表明这是一个32位/64位的冲突,但我有99%的肯定,我下载了64位版本的Eclipse和Java (RE 7u5),我选择这两个版本是因为我有64位的Windows 7。

如果有人知道如何确认我的Eclipse和Java是64位的, 非常感谢。 如果你认为我的问题不同,请帮忙! 请尽量直白地说,因为我对Eclipse完全不熟悉 和Java。

“C:\Program Files\ eclipse - sdk -4.2-win32-x86_64\eclipse\eclipse.exe”-vm“C:\Program Files (x86)\Java\jre7\bin\javaw.exe”

完整的错误代码…

Java was started but returned exit code=13
C:\Program Files (x86)\Java\jre7\bin\javaw.exe
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar
-os win32
-ws win32
-arch x86_64
-showsplash C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins\org.eclipse.platform_4.2.0.v201206081400\splash.bmp
-launcher C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\eclipse.exe
-name Eclipse
--launcher.library C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v201205221813\eclipse_1503.dll
-startup C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar
--launcher.overrideVmargs
-exitdata 1e30_5c
-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe
-vmargs
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar

当前回答

冒着不能给现有答案增加太多价值的风险,但我自己也经历过这些混乱,我想看看我是否能巩固我解决问题的方法:

Maintain separate Development from your normal machine environments. The reason for this is that there are probably many applications running on your machine that you are not aware of that need Java to be updated occasionally, for example banking and security applications. When those updates occur they change the environmental variables and so if you are using those in your development environment the update will almost certainly break your Eclipse setup. Install versions of Eclipse, either 32 and 64 bit depending on your plugins etc. The reason is that many plugins still require 32bit and trying to install them into a 64bit environment causes many obscure (very obscure) errors. This means for example you may have to have separate instances of Eclipse for your Java EE, PHP, Python, Assembler, etc, development environments. This may appear to be onerous, but for me this has been a blessing. Install two Java runtimes once again one 32bit and one 64bit and then edit the eclipse.ini for each of your installations to point to the correct JRE, not the JRE HOME in the environmental variables. I create a directory in C:\Java\64bit\jdk1.7.0_15\ and C:\Java\32bit\etc and in your eclipse.ini file you add the -vm C:\Java\64bit\jdk1.7.0_15\bin line to point to your needed java runtime.

一旦完成上述工作,您就可以随心所欲地安装Java sdk更新,但您的开发环境永远不会中断。如果您需要更新开发运行时环境,只需更改eclipse.ini中的-vm路径

其他回答

如果在带有32位JRE的PC上安装64位Eclipse版本,则保证会发生这种情况。

所以解决方案很简单:你需要通过更新其中一个来使它们同步。当下载Oracle Fusion中间件时,Eclipse需要32位环境,而您的JRE是64位的,并且您的JAVA home指向64位的JDK时,就会发生这种情况。

有OS、JDK和Eclipse的工作组合。在我的例子中,我使用的是64位JDK和64位操作系统上的32位Eclipse。在将JDK降级为32位之后,Eclipse开始工作。

使用下列组合之一。

32位OS, 32位JDK, 32位Eclipse(仅32位) 64位OS, 32位JDK, 32位Eclipse 64位OS, 64位JDK, 64位Eclipse(仅64位)

我刚刚在设置Windows 8.1电脑时解决了同样的问题。就像上面提到的@George Papatheodorou一样(抱歉我不能添加评论),Eclipse和JRE必须都是64位或32位。

然而,似乎对于Windows 8/8.1环境,默认情况下你将获得32位JRE(我不知道在哪里更改默认下载),如下所述:http://java.com/en/download/faq/win8_faq.xml

我使用的是64位的Eclipse,所以存在差异。然后我安装了32位的Eclipse,这次一切正常。

因此,在费心更改任何环境变量之前,请检查JRE和Eclipse版本。

当然,您可以将64位JRE与64位Eclipse一起使用。只要确保它们匹配,因为Windows 8.1默认为32位。

对我来说,解决方案是(在Windows 8.1上):

System > Advanced system setting > Environment Variables 

在“Path”变量中的“System variables”下,首先有以下内容:

C:\ProgramData\Oracle\Java\javapath;

我删除了这个,Eclipse又开始工作了!

可能是JDK组合问题,也可能是JDK版本问题,请选择合适的一个。我使用64位操作系统,64位JDK, 64位Eclipse IDE的组合。