Keeping eclipse running clean (an article about solving eclipse build slowness)

Source: Internet
Author: User
Tags virus checker

Original article URL: http://www.eclipsezone.com/eclipse/forums/t61566.htmlclick to open a link

In my time helping people with their eclipse installi have seen timeafter time situations where a crash of eclipse, the VM or the computeror even just long months of development have Ted starto wear down thestability
Of the workspace where eclipse stores everything. If you havetime some day, take a look at the <workspace dir> \. metadatadirectory to get an idea
Justhow much eclipse generates and stores in your workspace. every time youadd a plugin, upgrade a plugin, remove a plugin that puts and changesinformation in your workspace, much like your Windows registry as youinstall/upgrade/uninstall
Software on Windows.

Over time you may begin to notice strange behavior in your pluginswhile using them. clicking "Search" doesn' t actually do anything, AutoComplete no longer works or pops up strange results, you justinstalled a new plugin that is suppose to be stable and it
Doesn't workat all; what is going on? Chances are your workspace has gotten into astate where, for lack of a better technical understanding, hascollected lot a of dust and it is time to clean house.

Using the-clean argument

The easiest way to fix up a dusty workspace is using
-Clean command line argument to theeclipse.exe executable. Let 'stake a look at what the eclipse help docs tell us this command does:

If setto "true", any cached data used by the osgi framework and specified seruntime will be wiped clean. This will clean the caches used to storebundle dependency resolution and eclipse extension Registry
Data. usingthis option will force eclipse to reinitialize these caches.

The-clean argument is aone-Time Use flag, meaning after you have run eclipse using it, you canremove it until you need it again. if you prefer to leave it set theonly side effect of using it ever time are increased
Startup times (2-3x longer) which some folks do not mind.

Now, back to the description above, this may not sound like much, Ihave to say That you wocould be
Amazedat what using
-Clean can fixup sometimes; somereally random things. There are three easy ways you can go about usingthis argument:

  1. Edit the eclipse. ini file located in your <eclipse installdirectory> and add it as the first argument on the first line.
  2. Edit the shortcut you use to start eclipse and add it as thefirst argument.
  3. Create a batch or shell script that callthe eclipse executablewith
    -Clean argument. theadvantage to this step is you can keep the script around and use iteach time you want to clean out the workspace. You can name itsomething like eclipse-clean.bat (or eclipse-clean.sh ).

My preferred way to handle this is #1 only because I don't do thisvery often. I open my
Eclipse. INIFILE with any editor, add
-Cleanas the first argument, save the file and restart eclipse. After thisstep is done I remove the argument from the file, save it and exit frow.text editor.

Creating a new Workspace

Now let us say that using-cleandidn't help, things are still acting strange, the next step torecovering a stable development environment is to create a newworkspace and re-import your old settings and projects
It. As manytimes as I have seen using-cleansolve the most obscure problem or dirty workspace I have seen it notmake a lick of difference that only a new workspace wocould cure.

If you find yourself in the situation where you need to create a newworkspace, don't fear, since eclipse makes exporting and importing yourpreferences and projects the only time consuming part of this task isclicking a lot
OK and finish buttons.

The first step to creating a new workspace is to get everything youneed out of the current one, that means our preferences. You canaccomplish this by going
File> export...> preferences> "to preference file", give it aname> finish. The default at the top of the dialog shouldhave been
Export all, ifit wasn' t, be sure to select that before clicking finish. Also makesure you are exporting to a file to a neutral location, like yourdesktop.

After we are done exporting our preferences use
File> switch workspace commandto specify the location of a new workspace and then click
OK. After eclipse has restarted thefirst thing to do is pull in your old preferences. Go
File> Import> preferences> "from preferences file", select your File> finish. afteryour preferences are imported now it is on to the projects.

To import your projects use the File> Import> existing projects into workspace wizard. hereyou will select the directories of your old projects and import theminto your new Workspace
One at a time. With newer versions of Eclipse, there is a new option
Copy projectinto workspace that is a good option to check before your mingyour import. this will guaruntee that the physical files are copied outof the old workspace and into the new one. if you do not select thisoption, a link is created so you will
Need to keep the old workspacedirectory around as it holds the physical files
(Thanks Sanjay for the pointer !).

After you are done importingyour projects, you are all set with a new and clean workspace, congratulations!

Clean reinstall of eclipse

Now let's say that none of the tips above worked, the problem youwere having is still persisting and things just aren't working right. in my experience, if that is the case you most likely have a brokeninstall which more times than not stems from using incompatibleversions
Of plugins with the wrong base version of Eclipse. forexample, trying to use a eclipse 3.1 ga compatible plugin with eclipse3.2 milestone 2 release. these plugin developers have guarantees fromeclipse of API Stability During GA and stable release cycles that
Theydevelop against, when a stable plugin is then used in a nightly, integration or milestone build the chances that the underlying eclipseapis have changed are increased and it's possible that the plugin youare trying to use will no longer function correctly
Or just startfunctioning very strangely. As a responsible user You Need To Be awareof this and try and avoid this situation.

Now assuming you are using all the correct versions of eclipse andyour plugins and things are just broken (maybe you tested every pluginon eclipseplugincentral and your install is shot) here's a goodstrategy for getting back to a clean install of eclipse
And yourplugins.

First, I always suggest people perform new installparallel totheir old ones. don't go erasing your old eclipse install yet, use yournew install for at least a week to make sure you got it right beforeyou toast the old one. be sure to write down or remember
All theplugins you want to use with your clean install of Eclipse.

Second, redownload the most recent stable eclipse release (eclipse3.1.1 is the current stable release at the time of this writing) andunzip it to a new location. go ahead and install all of your plugins orat least the ones you can without running eclipse.

Third, be sure to make all the necessary changes to your
Eclipse. ini file or your cut foryour new install that you had with your old install.
Be sure to add
-Clean command line argument forthis first run since we are going to try and use your existingworkspace for this initially.

Last, fire up your new install of eclipse and point it at yourexisting workspace directory. now play around and see if the install isworking, if you are having a problem that continues to persist, thelast step in this journey is to create a new Workspace
To use with yournew install. Please follow the steps above in
Creating a new workspace section todo that.

If for some reason you are still experiencing trouble at this point, depending on the kind of problem, you shoshould start looking at andtesting native issues. your operating system patch level, libraryversions, Java version, up to date drivers, memory checker,
Hard drivechecker, virus checker, spyware checker, etc. any time I 've seen aproblem go this far it usually turned out to be either a userfundamentally not understanding what they were doing and it was usererror the entire time or there is a native issue
I outlined abve atplay here that needs to be resolved.

Conclusion

Now that you have made it this far, it means you have a cleaneclipse install. I hope this tip was helpful to some folks out therethat might be having some "strange behaviors" and aren't quite sure whyor what to do. thank you for reading.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.