212

If something is not working properly or some plug-ins are not loaded properly in my Eclipse I often get suggestion to open Eclipse in clean mode.

So, how to run in clean mode? And what happens if I do so?

Lii
  • 11,553
  • 8
  • 64
  • 88
GuruKulki
  • 25,776
  • 50
  • 140
  • 201

10 Answers10

284

What it does:

if set to "true", any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.

How to use it:

  • Edit the eclipse.ini file located in your Eclipse install directory and insert -clean as the first line.
  • Or edit the shortcut you use to start Eclipse and add -clean as the first argument.
  • Or create a batch or shell script that calls the Eclipse executable with the -clean argument. The advantage to this step is you can keep the script around and use it each time you want to clean out the workspace. You can name it something like eclipse-clean.bat (or eclipse-clean.sh).

(From: http://www.eclipsezone.com/eclipse/forums/t61566.html)

Other eclipse command line options: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Eran Medan
  • 44,555
  • 61
  • 184
  • 276
  • 37
    I recommend (2), creating a 'second' eclipse shortcut with the clean option. You don't want it in the eclipse.ini file, because that would disable the useful OSGi caching and increase eclipse startup time. Use clean only when you feel that you have to. – Andreas Dolk Jan 08 '10 at 22:00
  • 4
    @Andreas_D, so basically you should recommend (3) – Space Rocker Oct 04 '12 at 13:21
  • 4
    @SpaceRocker - why should I? Recommend whatever you like. I keep recommending the variation of "2", a second shortcut for "eclipse clean" (for windows environments, of course) – Andreas Dolk Oct 04 '12 at 23:02
  • 1
    In ubuntu in my ini file the first line is '-startup' I suppose I need to delete that in case i want to run it in clean mode? (and replace with -clean)? – michel.iamit Jan 08 '14 at 13:51
  • 2
    I edited your post because I down voted it by mistake and this was the only possibility to up vote your post (to remove an empty line). Sorry for this insignificant change, but the votes were locked. – ROMANIA_engineer Oct 30 '15 at 13:46
  • The link to the command line options does not work for me. This one (for Kepler) does work: http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html – David Balažic Sep 30 '16 at 09:13
  • The -_clean_ option also makes some plugins to clear their caches. For example it solves some "confusion" of the _subclipse_ plugin. – David Balažic Sep 30 '16 at 09:14
  • 2
    While the "-clean" argument might help in some situations, it definitely does NOT always work. For us, deleting the ".../configuration/org.eclipse.core.runtime" folder (there are 3 more "org.eclipse.xxx" folders in there) does the trick (eclipse e4 based application). – Michael Marton Feb 20 '19 at 15:29
83

For clean mode: start the platform like

eclipse -clean

That's all. The platform will clear some cached OSGi bundle information, it helps or is recommended if you install new plugins manually or remove unused plugins.

It will not affect any workspace related data.

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
36

You can start Eclipse in clean mode from the command line:

eclipse -clean
Spike Williams
  • 35,795
  • 13
  • 48
  • 60
18

Using the -clean option is the way to go, as mentioned by the other answers.

Make sure that you remove it from your .ini or shortcut after you've fixed the problem. It causes Eclipse to reevaluate all of the plugins everytime it starts and can dramatically increase startup time, depending on how many Eclipse plugins you have installed.

sygi
  • 4,557
  • 2
  • 32
  • 54
James Branigan
  • 1,164
  • 7
  • 9
13
  • click on short cut
  • right click -> properties
  • add -clean in target clause and then start.

it will take much time then normal start and it will fresh up all resources.

Vikdor
  • 23,934
  • 10
  • 61
  • 84
RTA
  • 1,251
  • 2
  • 14
  • 33
11

For Mac OS X Yosemite I was able to use the open command.

Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
Help: Open opens files from a shell.
      By default, opens each file using the default application for that file.  
      If the file is in the form of a URL, the file will be opened as a URL.
Options: 
      -a                Opens with the specified application.
      -b                Opens with the specified application bundle identifier.
      -e                Opens with TextEdit.
      -t                Opens with default text editor.
      -f                Reads input from standard input and opens with TextEdit.
      -F  --fresh       Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
      -R, --reveal      Selects in the Finder instead of opening.
      -W, --wait-apps   Blocks until the used applications are closed (even if they were already running).
          --args        All remaining arguments are passed in argv to the application's main() function instead of opened.
      -n, --new         Open a new instance of the application even if one is already running.
      -j, --hide        Launches the app hidden.
      -g, --background  Does not bring the application to the foreground.
      -h, --header      Searches header file locations for headers matching the given filenames, and opens them.

This worked for me:

open eclipse.app --args clean
gview
  • 14,876
  • 3
  • 46
  • 51
6

Easier option is to use ./eclipse -clean

venkatvb
  • 681
  • 1
  • 9
  • 24
nchouhan
  • 101
  • 1
  • 1
3

Two ways to run eclipse in clean mode.

1 ) In Eclipse.ini file

  • Open the eclipse.ini file located in the Eclipse installation directory.
  • Add -clean first line in the file.
  • Save the file.
  • Restart Eclipse.

enter image description here

2 ) From Command prompt (cmd/command)

  • Go to folder where Eclipse installed.
  • Take the path of Eclipse
  • C:..\eclipse\eclipse.exe -clean
  • press enter button

enter image description here

Lova Chittumuri
  • 2,994
  • 1
  • 30
  • 33
2

For Windows users: You can do as RTA said or through command line do this: Navigate to the locaiton of the eclipse executable then run:

 eclipse.lnk -clean

First check the name of your executable using the command 'dir' on its path

cristianorbs
  • 670
  • 3
  • 9
  • 16
0

This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.

  1. Open command prompt (cmd)
  2. Go to eclipse application location (D:\eclipse)
  3. Run command eclipse -clean
ngg
  • 1,493
  • 19
  • 14