Run Eclipse from the Command Line on OS X

If you’re looking to launch Eclipse passing in the -clean parameter on OS X you’ll want to cd into the eclipse directory that contains your Eclipse.app package and use the following syntax in bash or your favorite shell terminal:

./eclipse -clean -vmargs -XstartOnFirstThread

The arguments following ./eclipse are all passed to Eclipse and the arguments following -vmargs are passed to the Java jvm.

run Eclipse on OS X from commandline

As an alternative you can modify the Eclipse ini file (see image below for ini location). If you alter the ini file, the arguments set there will be passed in each time Eclipse is run as opposed to a one time deal with the command line.

Eclipse ini location

Why would you want to use the -clean argument? According to the documentation the -clean argument provides the following:

Cleans cached data used by the OSGi framework and Eclipse runtime. Try to run Eclipse once with this option if you observe startup errors after install, update, or using a shared configuration.

Newly installed plugins will often not work until Eclipse has been run with the -clean parameter. After a good chunk of time the Eclipse workspace may also become corrupt and -clean can sometimes work wonders. If you’re having Eclipse workspace issues check out Riyad Kalla’s excellent article.

Finally, if you’re like me and have hard time remembering where in the Eclipse help documentation you kind find all of the Eclipse startup arguments and their uses the Jing screengrab below should help.

Eclipse startup arguments / parameters

3 Comments

  1. Lancaster
    Posted July 11, 2007 at 6:18 pm | Permalink

    It’s about time you posted something new! Thanks for sharing this information. It will be invaluable in future projects:)

  2. Rajat
    Posted August 6, 2007 at 11:55 am | Permalink

    Thanks this article atleast got me started on how to use command line arguments. I was having a really hard time trying to figure that out.

    Thanks again

  3. Posted August 18, 2008 at 12:01 pm | Permalink

    Exactly what I was looking for. Thanks Brooks!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*