Java 如何在JDK中启动eclipse?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1917760/
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
Howto start eclipse in JDK?
提问by c0d3x
I just installed a Maven plug-in into eclipse the first time. Now there is a message on eclipse startup, that i should start eclipse in JDK not jre to make Maven components run fine. There is a -vm argument which I used in the eclipse.ini:
我第一次在eclipse中安装了一个Maven插件。现在 eclipse 启动时有一条消息,我应该在 JDK 而不是 jre 中启动 eclipse 以使 Maven 组件运行良好。我在 eclipse.ini 中使用了一个 -vm 参数:
-vm C:\Program Files (x86)\Java\
But the message is still there after restart.
但是重启后消息依然存在。
I've tried the:
我试过:
C:\Program Files (x86)\Java\bin
and also the:
还有:
C:\Program Files (x86)\Java\bin\java.exe
But nothing changed.
但什么都没有改变。
How do I start eclipse in JDK?
如何在 JDK 中启动 Eclipse?
Thanks in advance.
提前致谢。
采纳答案by Lumpy Oatmeal
If you're using Windows, right click on your eclipse shortcut and select Properties, in the Shortcut tab you can change what's in the Target: box to specify the jdk. I use
如果您使用的是 Windows,请右键单击您的 eclipse 快捷方式并选择“属性”,在“快捷方式”选项卡中,您可以更改“目标:”框中的内容以指定 jdk。我用
"C:\Program Files\eclipse-jee-galileo-sr1 (3.5.1)\eclipse.exe" -vm "C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe" -vmargs -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode
For some reason I couldn't get it to use the jdk when I tried editing the eclipse.ini file.
出于某种原因,当我尝试编辑 eclipse.ini 文件时,我无法让它使用 jdk。
回答by Bill the Lizard
You can specify which JVM to launch Eclipse under in your eclipse.ini
file. There are detailed instructions for different operating systems on the Eclipse wiki.
您可以在eclipse.ini
文件中指定在哪个 JVM 下启动 Eclipse 。Eclipse wiki 上有针对不同操作系统的详细说明。
回答by VonC
You have many more options in the Equinox Launcher page.
Equinox Launcher 页面中有更多选项。
And you have an example of a complete eclipse.ini with all options there.
您有一个包含所有选项的完整eclipse.ini示例。
When
no -vm
is specified, the launcher looks for a virtual machine first in a jre directory in the root of eclipse and then on the search path. If java is found in either location, then we look for a jvm shared library (jvm.dll
on window,libjvm.so
on *nix platforms) relative to that java executable.If a jvm shared library is found we load it and use the JNI invocation api to start the vm. If no jvm shared library is found, we exec the java launcher to start the vm in a new process.
-vm
specified on command line or ineclipse.ini
Eclipse can be started with "-vm <location>
" to indicate a virtual machine to use. There are several possibilities for the value of<location>
:
当
no -vm
被指定时,启动器的外观的虚拟机首先在蚀的根JRE目录,然后在搜索路径。如果在任一位置都找到了 java,那么我们会查找与该 java 可执行文件相关的 jvm 共享库(jvm.dll
在 window 上,libjvm.so
在 *nix 平台上)。如果找到一个 jvm 共享库,我们会加载它并使用 JNI 调用 api 来启动 vm。如果找不到 jvm 共享库,我们执行 java 启动器以在新进程中启动 vm。
-vm
在命令行或eclipse.ini
Eclipse 中指定的可以用“-vm <location>
”启动以指示要使用的虚拟机。的值有几种可能<location>
:
java.exe/javaw.exe
:<location>
is a path to a java launcher. We exec that java launcher to start the vm in a new process.jvm.dll
orlibjvm.so
:<location>
is a path to a jvm shared library. We attempt to load that library and use the JNI Invocation API to start the vm in the current process.vmDesc.ee
:<location>
is a path to a file ending in ".ee". This file is expected to describe the execution environment for a jvm. See the Execution Environment Descriptions page.- directory:
<location>
is a directory. We look in that directory for:- (1) a
default.ee
file, - (2) a java launcher or
- (3) the jvm shared library.
If we find the jvm shared library, we use JNI invocation.
If we find a launcher, we attempt to find a jvm library in known locations relative to the launcher.
If we find one, we use JNI invocation. If no jvm library is found, we exec java in a new process.
- (1) a
java.exe/javaw.exe
:<location>
是 java 启动器的路径。我们执行该 java 启动器以在新进程中启动 vm。jvm.dll
或libjvm.so
:<location>
是 jvm 共享库的路径。我们尝试加载该库并使用 JNI 调用 API 在当前进程中启动虚拟机。vmDesc.ee
:<location>
是以“.ee”结尾的文件的路径。该文件应描述 jvm 的执行环境。请参阅执行环境描述页面。- 目录:
<location>
是一个目录。我们在该目录中查找:- (1) 一个
default.ee
文件, - (2) 一个 java 启动器或
- (3)jvm共享库。
如果我们找到了 jvm 共享库,我们就使用 JNI 调用。
如果我们找到启动器,我们会尝试在相对于启动器的已知位置找到一个 jvm 库。
如果我们找到一个,我们使用 JNI 调用。如果找不到 jvm 库,我们在新进程中执行 java。
- (1) 一个
回答by jamiebarrow
Found how to add it to the INI, must add the parameter to the line below the -vm option, as below:
找到如何将其添加到INI中,必须将参数添加到-vm选项下方的行中,如下所示:
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vm
C:\Program Files\Java\jdk1.6.0_17\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m