已关闭8年。
您发现运行Eclipse的最佳JVM设置是什么?
最佳答案
又是一年中的那个时候:“eclipse.ini取3”设置反击!
Eclipse Helios 3.6和3.6.x设置
alt text http://www.eclipse.org/home/promotions/friends-helios/helios.png
在设置Eclipse Ganymede 3.4.x和Eclipse Galileo 3.5.x之后,下面将深入介绍Eclipse Helios 3.6.x的“优化” eclipse.ini 设置文件:
基于的
(通过“优化”,我的意思是能够在我们cr脚的工作站上运行全功能的Eclipse,这是2002年的一些旧P4,带有2Go RAM和XPSp3。但是我也在Windows7上测试了相同的设置)
Eclipse.ini
警告:对于非Windows平台,请使用Sun专有选项
-XX:MaxPermSize
而不是Eclipse专有选项--launcher.XXMaxPermSize
。即:除非使用,否则您使用的是最新的 jdk6u21 build 7 。
请参阅下面的Oracle部分。
-data
../../workspace
-showlocation
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vm
C:/Prog/Java/jdk1.6.0_21/jre/bin/server/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Declipse.p2.unsignedPolicy=allow
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+CMSIncrementalPacing
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/Prog/Java/eclipse_addons
注意:
使
p2.reconciler.dropins.directory
适应您选择的外部目录。看到这个SO answer。
这个想法是要能够独立于任何Eclipse安装将新插件拖放到目录中。
以下各节详细介绍了此
eclipse.ini
文件中的内容。可怕的Oracle JVM 1.6u21(内部版本7)和Eclipse崩溃
Andrew Niefer确实使我警惕了这种情况,并写了一个有关非标准vm参数(
-XX:MaxPermSize
)的blog post,这可能导致其他供应商的vm根本无法启动。但是该选项的eclipse版本(
--launcher.XXMaxPermSize
)在新的JDK(6u21,除非您使用6u21 build 7,请参见下文)上不起作用。最终的解决方案是在Eclipse Wiki和Windows上的Helios的上,仅使用6u21 pre build 7 :
(eclipse_home)/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503
That's it. No setting to tweak here (again, only for Helios on Windows with a 6u21 pre build 7).
For non-Windows platform, you need to revert to the Sun proprietary option -XX:MaxPermSize
.
The issue is based one a regression: JVM identification fails due to Oracle rebranding in java.exe, and triggered bug 319514 on Eclipse.
Andrew took care of Bug 320005 - [launcher] --launcher.XXMaxPermSize: isSunVM
should return true for Oracle, but that will be only for Helios 3.6.1.
Francis Upton, another Eclipse committer, reflects on the all situation.
Update u21b7, July, 27th:
Oracle have regressed the change for the next Java 6 release and won't implement it again until JDK 7.
If you use jdk6u21 build 7, you can revert to the --launcher.XXMaxPermSize
(eclipse option) instead of -XX:MaxPermSize
(the non-standard option).
The auto-detection happening in the C launcher shim eclipse.exe
will still look for the "Sun Microsystems
" string, but with 6u21b7, it will now work - again.
For now, I still keep the -XX:MaxPermSize
version (because I have no idea when everybody will launch eclipse the right JDK).
Implicit `-startup` and `--launcher.library`
Contrary to the previous settings, the exact path for those modules is not set anymore, which is convenient since it can vary between different Eclipse 3.6.x releases:
- startup: If not specified, the executable will look in the plugins directory for the
org.eclipse.equinox.launcher
bundle with the highest version. - launcher.library: If not specified, the executable looks in the
plugins
directory for the appropriateorg.eclipse.equinox.launcher.[platform]
fragment with the highest version and uses the shared library namedeclipse_*
inside.
Use JDK6
The JDK6 is now explicitly required to launch Eclipse:
-Dosgi.requiredJavaVersion = 1.6
此SO question报告了在Mac OS上进行开发的积极影响。
+ UnlockExperimentalVMOptions
以下选项是Sun JVM的一些实验选项的一部分。
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
已经在blog post中报告了它们,可能会加快Eclipse的速度。
查看所有JVM options here和官方Java Hotspot options page。
注意:detailed list of those options报告
UseFastAccessorMethods
可能默认处于 Activity 状态。另请参阅"Update your JVM":
从命令行在Eclipse中打开文件
请参阅Andrew Niefer的blog post报告此新选项:
--launcher.defaultAction
openFile
eclipse myFile.txt
请参阅bug 301033以供引用。最初是bug 4922(2001年10月,在9年后修复)。
p2和“未签名”对话框提示
如果您在安装许多插件时对这个对话框感到厌倦,请执行以下操作:
,添加
eclipse.ini
:-Declipse.p2.unsignedPolicy=allow
从blog post和Chris Aniszczy看到此bug report 235526。
---------- http://www.eclipse.org/home/categories/images/wiki.gif alt text http://www.eclipse.org/home/categories/images/wiki.gif alt text http://www.eclipse.org/home/categories/images/wiki.gif
附加选项
这些选项不直接在上面的
eclipse.ini
中,但是在需要时可以派上用场。Windows7上的`user.home`问题
eclipse启动时,它将读取其 key 存储文件(保存密码),该文件位于
user.home
中。如果由于某种原因
user.home
无法将其自身正确解析为完整路径,则Eclipse将不会启动。最初在this SO question中引发,如果您遇到这种情况,则需要将 keystore 文件重新定义为显式路径(开始时不再需要user.home来解析)
添加您的
eclipse.ini
:-eclipse.keyring
C:\eclipse\keyring.txt
这已由bug 300577跟踪,已在此other SO question中解决。
Debug模式
等等,Eclipse中有多个设置文件。
如果您在
eclipse.ini
中添加以下选项:-debug
,启用debug mode,Eclipse将寻找另一个设置文件:一个
.options
文件,您可以在其中指定一些OSGI选项。当您通过dropins文件夹添加新插件时,这很棒。
按照此blog post "Dropins diagnosis"中的说明,在.options文件中添加以下设置:
org.eclipse.equinox.p2.core/debug=true
org.eclipse.equinox.p2.core/reconciler=true
这来自Bug 264924 - [reconciler] No diagnosis of dropins problems,它最终解决了以下问题:
Unzip eclipse-SDK-3.5M5-win32.zip to ..../eclipse
Unzip mdt-ocl-SDK-1.3.0M5.zip to ..../eclipse/dropins/mdt-ocl-SDK-1.3.0M5
list 类路径
看到这个blog post:
这意味着您的某些项目可能不再在Helios中编译。
如果要还原为伽利略行为,请添加:
-DresolveReferencedLibrariesForContainers=true
有关引用,请参见bug 305037,bug 313965和bug 313890。
IPV4堆栈
当不访问插件更新站点时,此SO question提到了潜在的修复方法:
-Djava.net.preferIPv4Stack=true
此处提及的目的是为了防止它对您的配置有所帮助。
JVM1.7x64潜在的优化
This article报告:
-Xincgc
-XX:-DontCompileHugeMethods
-XX:MaxInlineSize=1024
-XX:FreqInlineSize=1024