score:315

Accepted answer

it is that time of year again: "eclipse.ini take 3" the settings strike back!

eclipse helios 3.6 and 3.6.x settings

alt text http://www.eclipse.org/home/promotions/friends-helios/helios.png

after settings for eclipse ganymede 3.4.x and eclipse galileo 3.5.x, here is an in-depth look at an "optimized" eclipse.ini settings file for eclipse helios 3.6.x:

(by "optimized", i mean able to run a full-fledge eclipse on our crappy workstation at work, some old p4 from 2002 with 2go ram and xpsp3. but i have also tested those same settings on windows7)

eclipse.ini

alt text

warning: for non-windows platform, use the sun proprietary option -xx:maxpermsize instead of the eclipse proprietary option --launcher.xxmaxpermsize.
that is: unless you are using the latest jdk6u21 build 7. see the oracle section below.

-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

note:
adapt the p2.reconciler.dropins.directory to an external directory of your choice.
see this so answer. the idea is to be able to drop new plugins in a directory independently from any eclipse installation.

the following sections detail what are in this eclipse.ini file.


the dreaded oracle jvm 1.6u21 (pre build 7) and eclipse crashes

andrew niefer did alert me to this situation, and wrote a blog post, about a non-standard vm argument (-xx:maxpermsize) and can cause vms from other vendors to not start at all.
but the eclipse version of that option (--launcher.xxmaxpermsize) is not working with the new jdk (6u21, unless you are using the 6u21 build 7, see below).

the final solution is on the eclipse wiki, and for helios on windows with 6u21 pre build 7 only:

(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 appropriate org.eclipse.equinox.launcher.[platform] fragment with the highest version and uses the shared library named eclipse_* inside.

use jdk6

the jdk6 is now explicitly required to launch eclipse:

-dosgi.requiredjavaversion = 1.6

this so question reports a positive incidence for development on mac os.


+unlockexperimentalvmoptions

the following options are part of some of the experimental options of the sun jvm.

-xx:+unlockexperimentalvmoptions
-xx:+useg1gc
-xx:+usefastaccessormethods

they have been reported in this blog post to potentially speed up eclipse.
see all the jvm options here and also in the official java hotspot options page.
note: the detailed list of those options reports that usefastaccessormethods might be active by default.

see also "update your jvm":

as a reminder, g1 is the new garbage collector in preparation for the jdk 7, but already used in the version 6 release from u17.


opening files in eclipse from the command line

see the blog post from andrew niefer reporting this new option:

--launcher.defaultaction
openfile

this tells the launcher that if it is called with a command line that only contains arguments that don't start with "-", then those arguments should be treated as if they followed "--launcher.openfile".

eclipse myfile.txt

this is the kind of command line the launcher will receive on windows when you double click a file that is associated with eclipse, or you select files and choose "open with" or "send to" eclipse.

relative paths will be resolved first against the current working directory, and second against the eclipse program directory.

see bug 301033 for reference. originally bug 4922 (october 2001, fixed 9 years later).


p2 and the unsigned dialog prompt

if you are tired of this dialog box during the installation of your many plugins:

alt text

, add in your eclipse.ini:

-declipse.p2.unsignedpolicy=allow

see this blog post from chris aniszczy, and the bug report 235526.

i do want to say that security research supports the fact that less prompts are better.
people ignore things that pop up in the flow of something they want to get done.

for 3.6, we should not pop up warnings in the middle of the flow - no matter how much we simplify, people will just ignore them.
instead, we should collect all the problems, do not install those bundles with problems, and instead bring the user back to a point in the workflow where they can fixup - add trust, configure security policy more loosely, etc. this is called 'safe staging'.

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

additional options

those options are not directly in the eclipse.ini above, but can come in handy if needed.


the `user.home` issue on windows7

when eclipse starts, it will read its keystore file (where passwords are kept), a file located in user.home.
if for some reason that user.home doesn't resolve itself properly to a full-fledge path, eclipse won't start.
initially raised in this so question, if you experience this, you need to redefine the keystore file to an explicit path (no more user.home to resolve at the start)

add in your eclipse.ini:

-eclipse.keyring 
c:\eclipse\keyring.txt

this has been tracked by bug 300577, it has been solve in this other so question.


debug mode

wait, there's more than one setting file in eclipse.
if you add to your eclipse.ini the option:

-debug

, you enable the debug mode and eclipse will look for another setting file: a .options file where you can specify some osgi options.
and that is great when you are adding new plugins through the dropins folder.
add in your .options file the following settings, as described in this blog post "dropins diagnosis":

org.eclipse.equinox.p2.core/debug=true
org.eclipse.equinox.p2.core/reconciler=true

p2 will inform you what bundles were found in dropins/ folder, what request was generated, and what is the plan of installation. maybe it is not detailed explanation of what actually happened, and what went wrong, but it should give you strong information about where to start:

  • was your bundle in the plan?
  • was it installation problem (p2 fault)
  • or maybe it is just not optimal to include your feature?

that comes from bug 264924 - [reconciler] no diagnosis of dropins problems, which finally solves the following issue like:

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

this is a problematic configuration since ocl depends on emf which is missing.
3.5m5 provides no diagnosis of this problem.

start eclipse.
no obvious problems. nothing in error log.

  • help / about / plugin details shows org.eclipse.ocl.doc, but not org.eclipse.ocl.
  • help / about / configuration details has no (diagnostic) mention of org.eclipse.ocl.
  • help / installation / information installed software has no mention of org.eclipse.ocl.

where are the nice error markers?


manifest classpath

see this blog post:

  • in galileo (aka eclipse 3.5), jdt started resolving manifest classpath in libraries added to project’s build path. this worked whether the library was added to project’s build path directly or via a classpath container, such as the user library facility provided by jdt or one implemented by a third party.
  • in helios, this behavior was changed to exclude classpath containers from manifest classpath resolution.

that means some of your projects might no longer compile in helios.
if you want to revert to galileo behavior, add:

-dresolvereferencedlibrariesforcontainers=true

see bug 305037, bug 313965 and bug 313890 for references.


ipv4 stack

this so question mentions a potential fix when not accessing to plugin update sites:

-djava.net.preferipv4stack=true

mentioned here just in case it could help in your configuration.


jvm1.7x64 potential optimizations

this article reports:

for the record, the very fastest options i have found so far for my bench test with the 1.7 x64 jvm n windows are:

-xincgc 
-xx:-dontcompilehugemethods 
-xx:maxinlinesize=1024  
-xx:freqinlinesize=1024 

but i am still working on it...

score:0

here's what i use (though i have them in the shortcut instead of the settings file):

eclipse.exe -showlocation -vm "c:\java\jdk1.6.0_07\bin\javaw.exe" -vmargs -xms256m -xmx768m -xx:+useparallelgc -xx:maxpermsize=128m

score:1

-vm
c:\program files\java\jdk1.6.0_07\jre\bin\client\jvm.dll

to specify which java version you are using, and use the dll instead of launching a javaw process

score:2

xx:+useparallelgc that's the most awesome option ever!!!

score:3

eclipse likes lots of ram. use at least -xmx512m. more if available.

score:3

if youre like me and had problems with the current oracle release of 1.6 then you might want to update your jdk or set

-xx:maxpermsize
. more information is available here: http://java.dzone.com/articles/latest-java-update-fixes

score:4

my own settings (java 1.7, modify for 1.6):

-vm
c:/program files (x86)/java/jdk1.7.0/bin
-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20100628
-showsplash
org.eclipse.platform
--launcher.xxmaxpermsize
256m
--launcher.defaultaction
openfile
-vmargs
-server
-dosgi.requiredjavaversion=1.7
-xmn100m
-xss1m
-xgcprio:deterministic
-xpausetarget:20
-xx:permsize=400m
-xx:maxpermsize=500m
-xx:compilethreshold=10
-xx:maxgcpausemillis=10
-xx:maxheapfreeratio=70
-xx:+unlockexperimentalvmoptions
-xx:+doescapeanalysis
-xx:+useg1gc
-xx:+usefastaccessormethods
-xx:+aggressiveopts
-xms512m
-xmx512m

score:5

here's my own setting for my eclipse running on i7 2630m 16gb ram laptop, this setting has been using for a week, without a single crashing, and eclipse 3.7 is running smoothly.

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultaction
openfile
--launcher.xxmaxpermsize
256m
-showsplash
org.eclipse.platform
--launcher.xxmaxpermsize
256m
--launcher.defaultaction
openfile
-vmargs
-dosgi.requiredjavaversion=1.5
-xms1024m
-xmx4096m 
-xx:maxpermsize=256m

calculations: for win 7 x64

  • xms = physical memory / 16
  • xmx = physical memory / 4
  • maxpermsize = same as default value, which is 256m

score:5

-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.xxmaxpermsize
256m
--launcher.defaultaction
openfile
-vmargs
-xms128m
-xmx512m
-xx:maxpermsize=256m
-xdock:icon=../resources/eclipse.icns
-xstartonfirstthread
-dorg.eclipse.swt.internal.carbon.smallfonts
-dcom.sun.management.jmxremote
-declipse.p2.unsignedpolicy=allow

and these setting have worked like a charm for me. i am running os x10.6 , eclipse 3.7 indigo , jdk1.6.0_24

score:7

you can also try running with jrockit. it's a jvm optimized for servers, but many long running client applications, like ide's, run very well on jrockit. eclipse is no exception. jrockit doesn't have a perm-space so you don't need to configure it.

it's possible set a pause time target(ms) to avoid long gc pauses stalling the ui.

-showsplash
org.eclipse.platform
-vm
 c:\jrmc-3.1.2-1.6.0\bin\javaw.exe 
-vmargs
-xgcprio:deterministic
-xpausetarget:20

i usually don't bother setting -xmx and -xms and let jrockit grow the heap as it sees necessary. if you launch your eclipse application with jrockit you can also monitor, profile and find memory leaks in your application using the jrockit mission control tools suite. you download the plugins from this update site. note, only works for eclipse 3.3 and eclipse 3.4

score:9

if you are using linux + sun jdk/jre 32bits, change the "-vm" to:

-vm 
[your_jdk_folder]/jre/lib/i386/client/libjvm.so

if you are using linux + sun jdk/jre 64bits, change the "-vm" to:

-vm
[your_jdk_folder]/jre/lib/amd64/server/libjvm.so

that's working fine for me on ubuntu 8.10 and 9.04

score:9

if you're going with jdk6 update 14, i'd suggest using using the g1 garbage collector which seems to help performance.

to do so, remove these settings:

-xx:+useconcmarksweepgc
-xx:+cmsincrementalmode
-xx:+cmsincrementalpacing

and replace them with these:

-xx:+unlockexperimentalvmoptions
-xx:+useg1gc

score:14

-showlocation

to make it easier to have eclipse running twice, and know which workspace you're dealing with

eclipse 3.6 adds a preferences option to specify what to show for the workspace name (shown in window title) which works much better than -showlocation for three reasons:

  1. you do not need to restart eclipse for it to take affect.
  2. you can chose a short code.
  3. it appears first, before the perspective and application name.

score:20

eclipse indigo 3.7.2 settings (64 bit linux)

settings for sun/oracle java version "1.6.0_31" and eclipse 3.7 running on x86-64 linux:

-nosplash
-vmargs
-xincgc
-xss500k
-dosgi.requiredjavaversion=1.6
-xms64m
-xmx200m
-xx:newsize=8m
-xx:permsize=80m
-xx:maxpermsize=150m
-xx:maxpermheapexpansion=10m
-xx:+useconcmarksweepgc
-xx:cmsinitiatingoccupancyfraction=70
-xx:+usecmsinitiatingoccupancyonly
-xx:+useparnewgc
-xx:+cmsconcurrentmtenabled
-xx:concgcthreads=2
-xx:parallelgcthreads=2
-xx:+cmsincrementalpacing
-xx:cmsincrementaldutycyclemin=0
-xx:cmsincrementaldutycycle=5
-xx:gctimeratio=49
-xx:maxgcpausemillis=20
-xx:gcpauseintervalmillis=1000
-xx:+usecmscompactatfullcollection
-xx:+cmsclassunloadingenabled
-xx:+doescapeanalysis
-xx:+usecompressedoops
-xx:+aggressiveopts
-xx:+explicitgcinvokesconcurrentandunloadsclasses

note that this uses only 200 mb for the heap and 150 mb for the non-heap. if you're using huge plugins, you might want to increase both the "-xmx200m" and "-xx:maxpermsize=150m" limits.

the primary optimization target for these flags has been to minimize latency in all cases and as a secondary optimization target minimize the memory usage.

score:63

eclipse ganymede 3.4.2 settings


for more recent settings, see eclipse galileo 3.5 settings above.


jdk

the best jvm setting always, in my opinion, includes the latest jdk you can find (so for now, jdk1.6.0_b07 up to b16, except b14 and b15)

eclipse.ini

even with those pretty low memory settings, i can run large java projects (along with a web server) on my old (2002) desktop with 2go ram.

-showlocation
-showsplash
org.eclipse.platform
--launcher.xxmaxpermsize
256m
-framework
plugins\org.eclipse.osgi_3.4.2.r34x_v20080826-1230.jar
-vm
jdk1.6.0_10\jre\bin\client\jvm.dll
-vmargs
-dosgi.requiredjavaversion=1.5
-xms128m
-xmx384m
-xss2m
-xx:permsize=128m
-xx:maxpermsize=128m
-xx:maxgcpausemillis=10
-xx:maxheapfreeratio=70
-xx:+useconcmarksweepgc
-xx:+cmsincrementalmode
-xx:+cmsincrementalpacing
-xx:compilethreshold=5
-dcom.sun.management.jmxremote

see gkelly's so answer and piotr gabryanczyk's blog entry for more details about the new options.

monitoring

you can also consider launching:

c:\[jdk1.6.0_0x path]\bin\jconsole.exe

as said in a previous question about memory consumption.

score:76

eclipse galileo 3.5 and 3.5.1 settings

currently (november 2009), i am testing with jdk6 update 17 the following configuration set of options (with galileo -- eclipse 3.5.x, see below for 3.4 or above for helios 3.6.x):
(of course, adapt the relative paths present in this eclipse.ini to the correct paths for your setup)

note: for eclipse3.5, replace startup and launcher.library lines by:

-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

eclipse.ini 3.5.1

-data
../../workspace
-showlocation
-showsplash
org.eclipse.platform
--launcher.xxmaxpermsize
384m
-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
-vm
../../../../program files/java/jdk1.6.0_17/jre/bin/client/jvm.dll
-vmargs
-dosgi.requiredjavaversion=1.5
-xms128m
-xmx384m
-xss4m
-xx:permsize=128m
-xx:maxpermsize=384m
-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

see also my original answer above for more information.

changes (from july 2009)

  • refers to the launcher and not the framework
  • shared plugins: org.eclipse.equinox.p2.reconciler.dropins.directory option.
  • galileo supports fully relative paths for workspace or vm (avoid having to modify those from one eclipse installation to another, if, of course, your jvm and workspace stay the same)
    before, those relative paths kept being rewritten into absolute ones when eclipse launched itself...
  • you also can copy the jre directory of a java jdk installation inside your eclipse directory

caveats

there was a bug with ignored breakpoints actually related to the jdk.
do use jdk6u16 or more recent for launching eclipse (you can then define as many jdks you want to compile within eclipse: it is not because you launch an eclipse with jdk6 that you will have to compile with that same jdk).

max

note the usage of:

--launcher.xxmaxpermsize
384m
-vmargs
-xx:maxpermsize=128m

as documented in the eclipse wiki,

eclipse 3.3 supports a new argument to the launcher: --launcher.xxmaxpermsize.
if the vm being used is a sun vm and there is not already a -xx:maxpermsize= vm argument, then the launcher will automatically add -xx:maxpermsize=256m to the list of vm arguments being used.
the 3.3 launcher is only capable of identifying sun vms on windows.

as detailed in this entry:

not all vms accept the -xx:maxpermsize argument which is why it is passed in this manner. there may (or may not) exist problems with identifying sun vms.
note: eclipse 3.3.1 has a bug where the launcher cannot detect a sun vm, and therefore does not use the correct permgen size. it seems this may have been a known bug on mac os x for 3.3.0 as well.
if you are using either of these platform combination, add the -xx flag to the eclipse.ini as described above.

notes:

  • the "384m" line translates to the "=384m" part of the vm argument, if the vm is case sensitive on the "m", then the so is this argument.
  • the "--launcher." prefix, this specifies that the argument is consumed by the launcher itself and was added to launcher specific arguments to avoid name collisions with application arguments. (other examples are --launcher.library, --launcher.suppresserrors)

the -vmargs -xx:maxpermsize=384m part is the argument passed directly to the vm, bypassing the launcher entirely and no check on the vm vendor is used.


Related Query

More Query from same tag