David Bakin’s programming blog.


When is a newline required to separate command line arguments? When it is in your eclipse.ini!

This cost me two full days—very embarrassing in front of my new colleagues.  I set up a new Eclipse installation (I am an Eclipse newbie) following their detailed instructions, and tried to load their very large project.  Eclipse kept crashing, after 10 to 30 seconds, with OutOfMemory PermGen errors. The solution, as any one of 100 blog posts will tell you, is to add -XX:MaxPermSize=512m to your eclipse.ini. Which I did, to no effect. I tried different values for MaxPermSize, multiple different versions of Eclipse, made sure I was running the proper Sun JVM, etc. etc. etc.  Finally hooked up jconsole and discovered that I was getting these OutOfMemory PermGen errors when PermGen was nowhere near filling my expanded space limit.

Now, note:  ps showed that the vm was started with the right command line parameter, -XX:MaxPermSize=512m. Eclipse’s own error dialog showed it after a crash. jconsole showed it. But it was being ignored!?!

The solution was this: I had, in the interest of making eclipse.ini easier to read, reformatted it so instead of saying, e.g.,

--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=512m
-Xms40m
-Xmx512m

it was instead:

--launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=512m -Xms40m -Xmx512m

And that was the problem!  Putting the parameters to the command line arguments on the same line caused them not to be recognized!

So: don’t do that!