Eclipse JVM 配置

发布于 2024-08-04 16:07:06 字数 3216 浏览 3 评论 0原文

背景:我已经安装了新的 eclipse 并安装了 m2eclipse 插件。启动后 m2eclipse 生成消息:

Eclipse 运行在 JRE 中,但运行在 JDK 中 为必填项

按照 此处的说明进行操作 我已经更改了 eclipse.ini 文件以使用 JDK JVM:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.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
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"

但是,重新启动 eclipse 后,我仍然收到消息说它在 JRE 下运行,而不是在 JDK 下运行。

通过Help -> 查看 Eclipse 配置关于 Eclipse ->安装详情->配置 看起来 eclipse 正在从其他地方获取 JVM 配置详细信息:

...
-vm
C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.home.location=file:/C:/Program Files (x86)/eclipse/
eclipse.launcher=C:\Program Files (x86)\eclipse\eclipse.exe
[email protected]/../p2/
eclipse.p2.profile=epp.package.jee
eclipse.product=org.eclipse.epp.package.jee.product
eclipse.startTime=1252669330296
eclipse.vm=C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.vmargs=-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"
-XX:MaxPermSize=256m
...

我的问题是第一个 -vm 参数来自哪里以及如何删除或更改它?

谢谢

更新:我已经根据 VonC 的回答更新了 eclipse.ini 文件。我现在在启动 eclipse 时收到错误消息:

必须有 Java 运行时环境 (JRE) 或 Java 开发工具包 (JDK) 才能运行 Eclipse。搜索以下位置后未找到 Java 虚拟机:“C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe”

我确认路径正确,可以通过命令行执行。

完成下面的 eclipse.ini:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.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_16\bin\javaw.exe"
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m

解决方案: eclipse.ini 文件似乎仍然有问题。我将其完全替换为 VonC 在他链接的帖子中给出的设置,并且 Eclipse 现在可以正常启动并使用正确的 JVM。下面为有同样问题的其他人提供完整的 eclipse.ini:

-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-vm
C:\Program Files (x86)\Java\jdk1.6.0_16\jre\bin\client\jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/jv/eclipse/mydropins

Background: I've got a new eclipse installation and have installed the m2eclipse plugin. After startup m2eclipse generates the message:

Eclipse is running in a JRE, but a JDK
is required

Following the instructions from here I've changed the eclipse.ini file to use the JDK JVM:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.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
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"

After restarting eclipse however, I still get the message saying its running under the JRE and not the JDK.

Looking at the eclipse configuration via Help -> About Eclipse -> Installation Details -> Configuration it seems like eclipse is picking up the JVM configuration details from somewhere else:

...
-vm
C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.home.location=file:/C:/Program Files (x86)/eclipse/
eclipse.launcher=C:\Program Files (x86)\eclipse\eclipse.exe
[email protected]/../p2/
eclipse.p2.profile=epp.package.jee
eclipse.product=org.eclipse.epp.package.jee.product
eclipse.startTime=1252669330296
eclipse.vm=C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.vmargs=-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"
-XX:MaxPermSize=256m
...

My question is where is the first -vm argument coming from and how can I remove or change it?

Thanks

Update: I have updated the eclipse.ini file as per VonC's answer. I'm now getting an error when launching eclipse saying:

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: "C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"

I've confirmed that the path is correct and can be executed via the command line.

Complete eclipse.ini below:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.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_16\bin\javaw.exe"
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m

Solution: it seems like there was still something wrong with the eclipse.ini file. I replaced it completely with the settings given by VonC in the post he linked and eclipse is now starting properly and using the correct JVM. Full eclipse.ini below for anyone else with the same problem:

-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-vm
C:\Program Files (x86)\Java\jdk1.6.0_16\jre\bin\client\jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/jv/eclipse/mydropins

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

断桥再见 2024-08-11 16:07:06

请参阅:

为例参数顺序。

-vm 应该在 -vmargs 之前


6 年后更新 (2015)

E Riz 在评论中提到新的 Eclipse 安装程序 将为您检测 JVM,或建议下载。

https: //www.eclipse.org/downloads/assets/public/images/installer-instructions-04.png

See:

for an example of parameters order.

-vm should be before -vmargs


Update 6 years laters (2015)

E Riz mentions in the comments that the new Eclipse Installer will detect the JVM for you, or propose ones to download.

https://www.eclipse.org/downloads/assets/public/images/installer-instructions-04.png

花之痕靓丽 2024-08-11 16:07:06

令人难以置信的是,这个问题的解决方案对我来说与斜杠,反斜杠,引号,空格,jre,jdk,jvm,javaw,...无关。

答案是你必须在 - 之间有一个换行符vm 和路径。

所以在 eclipse.ini 文件中:

这不会工作:

-vm C:\java\jdk\bin\javaw.exe

但是这会:

-vm
C:\java\jdk\bin\javaw.exe

Unbelievable, the solution to this problem for me has nothing to do with slashes, backslashes, quotes, spaces, jre, jdk, jvm, javaw, ....

The answer is that you have to have a line break between -vm and the path.

So in the eclipse.ini file:

THIS WILL NOT WORK:

-vm C:\java\jdk\bin\javaw.exe

BUT THIS WILL:

-vm
C:\java\jdk\bin\javaw.exe
烟若柳尘 2024-08-11 16:07:06

我认为你的机器是64位windows?

我在网站上看不到 64 位 Windows 版本的 eclipse。因此可能只有 32 位可用。
您确定您的机器上安装了 32 位 JDK 吗?
只是一个想法...

I think your machine is 64bit windows?

I cannot see a 64bit windows version of eclipse in the site. So only 32 bit might be available.
Are you sure you have a 32bit JDK installed in your machine?
Just a thought...

ゃ懵逼小萝莉 2024-08-11 16:07:06

如果您使用的是 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
由于某种原因,当我尝试编辑 eclipse.ini 文件时,我无法让它使用 jdk。

如何在 JDK 中启动 eclipse?

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

"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.

Howto start eclipse in JDK?

小梨窩很甜 2024-08-11 16:07:06

我的问题是
-vm
“C:\Program Files\Java\jdk1.7.0_67\jre\bin\javaw.exe”

路径在引号中,当我删除它工作的引号时:

-vm
C:\Program Files\Java\jdk1.7.0_67\jre\bin\javaw.exe

My issue was that
-vm
"C:\Program Files\Java\jdk1.7.0_67\jre\bin\javaw.exe"

the path was in quotes, when i removed the quotes it worked:

-vm
C:\Program Files\Java\jdk1.7.0_67\jre\bin\javaw.exe

我不咬妳我踢妳 2024-08-11 16:07:06

您应该在 -vm 参数之后提及 javaw.exe 的完整路径,而不使用双引号,即“”,每个 -vm 和路径必须位于不同的行中,并且 -vm 必须位于 -vmargs 之前。例如:

-vm
C:\Program Files\Java\jrockit-jre1.6.0_45-R28.2.7\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
-XX:+UnlockDiagnosticVMOptions
-XX:MaxClassBlockMemory=75M

You should mention the full path of javaw.exe after -vm argument without using double quotes, i.e. "", each of -vm and the path has to be in different lines and -vm must be before -vmargs. For example:

-vm
C:\Program Files\Java\jrockit-jre1.6.0_45-R28.2.7\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
-XX:+UnlockDiagnosticVMOptions
-XX:MaxClassBlockMemory=75M
屌丝范 2024-08-11 16:07:06

我解决这个问题。

当您在 Eclipse 中创建 Maven 项目时,该项目属性中的文本文件编码可能与 pom.xml 中的 project.build.sourceEncoding 不同。当您构建此项目时,它也会报告“无法在以下位置找到 Javac 编译器:...”错误。

例如,我的文本文件编码是GBK,而project.build.sourceEncoding是UTF-8,所以发生了这个错误。我刚刚将文本文件编码修改为UTF-8。

I solve this question.

When you create a Maven Project in Eclipse maybe the text file encoding in this project's properties and the project.build.sourceEncoding in the pom.xml was not the same. When you build this project it would report "Unable to locate the Javac Compiler in:..." error, too.

For example, my text file encoding was GBK and project.build.sourceEncoding was UTF-8 so this error happened. I just modified the text file encoding to UTF-8.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文