Eclipse 启动错误:JRE/JDK 必须可用

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

Eclipse startup error : JRE/JDK must be available

eclipsejavaeclipse-indigo

提问by AnujKu

Downloaded latest eclipse for Java EE Opened... error .. opening...JRE/JDK must be available for running eclipse.. Unlike normal my java is installed in G:/ Do I have to make any changes to ecplise.ini in -vm tag ? Like adding java jdk bin path ? Did not work somehow ! Any idea ?

为 Java EE 下载了最新的 Eclipse Opened... error .. opening... JRE/JDK must be available for running eclipse.. 与正常情况不同,我的 java 安装在 G:/ 中是否必须对 ecplise.ini -vm 标签?喜欢添加 java jdk bin 路径?不知何故不起作用!任何的想法 ?

回答by mprabhat

Eclipse looks at PATH variable for choosing which JRE to use, if that is configured eclipse will work correctly, if you don't have or want to point eclipse to a specific Java Installation then you can provide following argument in eclipse.ini

Eclipse 查看 PATH 变量以选择要使用的 JRE,如果已配置 Eclipse 将正常工作,如果您没有或想要将 Eclipse 指向特定的 Java 安装,那么您可以提供以下参数 eclipse.ini

-vm
G:\Java

You can see different runtime options available here.

您可以在此处查看不同的运行时选项。

回答by user2734835

You can start Eclipse by running eclipse.exe on Windows or eclipse on other platforms. This small launcher essentially finds and loads the JVM. On Windows, the eclipsec.exe console executable can be used for improved command line behavior.

您可以通过在 Windows 上运行 eclipse.exe 或在其他平台上运行 eclipse 来启动 Eclipse。这个小型启动器本质上是查找并加载 JVM。在 Windows 上,eclipsec.exe 控制台可执行文件可用于改进命令行行为。

Alternatively, you can launch Eclipse by directly invoking the JVM as follows:

或者,您可以通过直接调用 JVM 来启动 Eclipse,如下所示:

java -jar eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar NOTE: The version of org.eclipse.equinox.launcher in the above command must match the version actually shipped with Eclipse. For more details on launching Eclipse using Java (not eclipse.exe) with the launcher, see Starting Eclipse Commandline With Equinox Launcher.

java -jar eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar 注意:上述命令中的 org.eclipse.equinox.launcher 版本必须与 Eclipse 实际附带的版本匹配。有关使用 Java(而非 eclipse.exe)和启动器启动 Eclipse 的更多详细信息,请参阅使用 Equinox 启动器启动 Eclipse 命令行。

Find the JVM

找到JVM

If a JVM is installed in the eclipse/jre directory, Eclipse will use it; otherwise the launcher will consult the eclipse.ini file and the system path variable. Eclipse DOES NOT consult the JAVA_HOME environment variable.

如果eclipse/jre目录下安装了JVM,Eclipse会使用它;否则启动器将查询 eclipse.ini 文件和系统路径变量。Eclipse 不咨询 JAVA_HOME 环境变量。

To explicitly specify a JVM of your choice, you can use the -vm command line argument:

要明确指定您选择的 JVM,您可以使用 -vm 命令行参数:

eclipse -vm c:\jre\bin\javaw.exe ''start Java by executing the specified java executable eclipse -vm c:\jre\bin\client\jvm.dll ''start Java by loading the jvm in the eclipse process See the launcher page for more details on specifying a JVM.

eclipse -vm c:\jre\bin\javaw.exe ''通过执行指定的java可执行文件启动Java eclipse -vm c:\jre\bin\client\jvm.dll ''通过在eclipse进程中加载​​jvm来启动Java有关指定 JVM 的更多详细信息,请参阅启动器页面。

eclipse.ini

eclipse.ini

The most recommended way to specify a JVM for Eclipse to run in is to put startup configuration into the eclipse.ini file in the same folder as the Eclipse executable (eclipse.exe on Windows). The Eclipse program launcher will read arguments from either the command-line or the configuration file named eclipse.ini. To specify a JVM using configuration file, include the -vm argument in eclipse.ini, for example:

为 Eclipse 指定运行 JVM 的最推荐方法是将启动配置放入与 Eclipse 可执行文件(Windows 上的 eclipse.exe)相同文件夹中的 eclipse.ini 文件中。Eclipse 程序启动器将从命令行或名为 eclipse.ini 的配置文件读取参数。要使用配置文件指定 JVM,请在 eclipse.ini 中包含 -vm 参数,例如:

-vm c:/jre/bin/javaw.exeNote: there are no quotes around this path as would be required when executing the same from the command-line were the path to contain white space, etc. This is a common mistake when using Windows.

-vm c:/jre/bin/javaw.exe注意:此路径周围没有引号,因为从命令行执行相同的路径时需要包含空格等。这是一个常见的错误使用 Windows。

Eclipse now will launch without additional arguments in the command-line, with the JVM specified in the eclipse.ini configuration file.

Eclipse 现在将在命令行中不带附加参数的情况下启动,并在 eclipse.ini 配置文件中指定 JVM。

You should always use -vm so you can be sure of what VM you are using. Installers for other applications sometimes modify the system path variable, thus changing the VM used to launch Eclipse without your knowing about it.

您应该始终使用 -vm,这样您就可以确定正在使用的 VM。其他应用程序的安装程序有时会修改系统路径变量,从而在您不知情的情况下更改用于启动 Eclipse 的 VM。

The format of the eclipse.ini file is very particular; it is strongly recommended to read eclipse.ini and follow the examples there.

eclipse.ini 文件的格式非常特殊;强烈建议阅读 eclipse.ini 并按照那里的示例进行操作。

When Eclipse starts, you are prompted to choose a workspace location on start-up. This behavior can be configured in the Preferences. You can manually specify the workspace location on the command line, using the -data command-line argument.

Eclipse 启动时,系统会提示您在启动时选择工作区位置。可以在首选项中配置此行为。您可以使用 -data 命令行参数在命令行上手动指定工作区位置。

OLD: Starting Eclipse 3.2

旧:启动 Eclipse 3.2

In Eclipse 3.2 and earlier, there was an additional file in the root of Eclipse: startup.jar. This jar file contained the classes needed to start the platform. In 3.3 and above the equivalent classes are in the org.eclipse.equinox.launcher bundle.

在 Eclipse 3.2 及更早版本中,Eclipse 的根目录中有一个附加文件:startup.jar。这个 jar 文件包含启动平台所需的类。在 3.3 及更高版本中,等效类位于 org.eclipse.equinox.launcher 包中。

To start 3.2 by directly invoking the JVM use the following command:

要通过直接调用 JVM 来启动 3.2,请使用以下命令:

java -cp eclipse/startup.jar org.eclipse.core.launcher.Main

Eclipse 3.2 did not contain a console version of the executable.

Eclipse 3.2 不包含可执行文件的控制台版本。

OLD: Oracle/Sun VM 1.6.0_21 on Windows

旧:Windows 上的 Oracle/Sun VM 1.6.0_21

The Eclipse 3.3 - 3.6 launchers for Windows had a problem with the Oracle/Sun Java VM version '1.6.0_21-b06'.

适用于 Windows 的 Eclipse 3.3 - 3.6 启动器在 Oracle/Sun Java VM 版本“1.6.0_21-b06”上存在问题。

UPDATE: Oracle/Sun have released a respin of their JDK/JRE to fix this, so the recommended resolution of this problem is to download and re-install version 1.6.0_21-b07'. Make sure you have b07 or higher by running java -version.

更新:Oracle/Sun 已经发布了他们的 JDK/JRE 的重新版本来解决这个问题,所以这个问题的推荐解决方案是下载并重新安装版本 1.6.0_21-b07'。通过运行 java -version 确保您有 b07 或更高版本。

Before the fix was released, there were three choices to work around this:

在发布修复程序之前,有三种选择可以解决此问题:

1----switch back to '1.6.0_20' (as of July 19, 2010 it can still be downloaded here) Change the commandline for launching or add the following line after "-vmargs" to your Eclipse.ini file: -XX:MaxPermSize=256m (Detailed instructions/examples)http://wiki.eclipse.org/Eclipse.ini

1----切换回“1.6.0_20”(截至 2010 年 7 月 19 日,它仍然可以在此处下载)更改启动命令行或在“-vmargs”之后添加以下行到您的 Eclipse.ini 文件:- XX:MaxPermSize=256m(详细说明/示例)http://wiki.eclipse.org/Eclipse.ini

2----For 32-bit Helios, download the fixed eclipse_1308.dll and place it into (eclipse_home)/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503(https://bugs.eclipse.org/bugs/attachment.cgi?id=174640)

2----对于32位Helios,下载已修复的eclipse_1308.dll并将其放入(eclipse_home)/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503( https://bugs .eclipse.org/bugs/attachment.cgi?id=174640)

{The Java bug was closed for voting and comments at 6969236 on the Java BugParade because the change has been reverted; the related Eclipse bug report is open for voting and comments at bug 319514.}

{Java 错误已在 Java BugParade 上的 6969236 投票和评论关闭,因为更改已恢复;相关的 Eclipse 错误报告在错误 319514 处开放投票和评论。}