Aug 3, 2012

f Comment

How Do You Tell Eclipse To Rebuild Index? I NO LONGER Find the Resource I Need In Eclipse Workspace!

Amazon My Eclipse IDE is acting up When I search for Type or press Control and mouse-click some variable or class I just cannot find the resource I want even though I am positive it exists in the current workspace. They worked before and now stopped working. When I open Type or Method dialog nothing is being populated!

WHY? I know Eclipse builds index to enable fast search but I have looked all over the place and just cannot find any command that says "rebuild index" or "refresh index" or "Click Me To Build My Bad Broken Index Again So You'll Be Able To Find The Resource And File You Need". I TOTALLY understand your frustrations!

Turns out the solution is quite easy. Just follow the following steps and you'll be able to find the desired resource in the workspace in MINUTES!

Step 1: Delete Current Index Directory
Eclipse uses an algorithm called DLTK to perform indexing which results in several database files that contain the indices. Unfortunately at the time of writing the latest Eclipse version (Juno) does not have an explicit way to rerun the DLTK indexing via the workspace. Luckily Eclipse keeps those indexes in the following folder:

[your workspace]\.metadata\.plugins\org.eclipse.dltk.core.index.sql.h2
Simply delete the [your workspace]\.metadata\.plugins\org.eclipse.dltk.core.index.sql.h2 directory!

Step 2: Restart Eclipse
Close and start Eclipse again. Observe the lower right corner of your Eclipse workspace and you should see the following screenshot.

Eclipse DLTK Indexing In Progress

This means Eclipse is building DLTK index right now. Meanwhile observe in [your workspace]\.metadata\.plugins that 'org.eclipse.dltk.core.index.sql.h2' directory has been recreated by Eclipse! Go into that directory and you should see the following screenshot:

Eclipse DLTK Index Directory

Keep an eye on the size column. While Eclipse is building DLTK index the size of the files is increasing.

Now give it some time until the message is gone. When it is gone look in [your workspace]\.metadata\.plugins\org.eclipse.dltk.core.index.sql.h2 and the size of each of the files should stabilize. Now search for Type or Resource again or press Control and mouse-click some class or variable and you should be able to locate the resource!

I use Eclipse Helios (Service Release 1) and Eclipse Indigo and Eclipse PDT with Zend Studio for PHP development and my solution works for all of them.
Now that you have the index fixed you should be able to find your favorite resources with Open Type, Auto-complete, Open Resource, etc. again! Life is GREAT

If you have any questions let me know and I will do my best to help you!
Please leave a comment here!
One Minute Information - by Michael Wen
ADVERTISING WITH US - Direct your advertising requests to Michael