131

I am using eclipse 3.4.1 Java EE under Vista. It seems to like getting stuck when building my workspace. Canceling the build doesn't seem to do anything as well.

Why is this happening and how do I fix the problem?

2

31 Answers 31

148

I was able to fix this with the following:

First, exit Eclipse. Then temporarily move the following .projects folder to a safe location:

mv .metadata\.plugins\org.eclipse.core.resources\.projects projects

Start and exit Eclipse, then move the .projects folder back to where it was originally:

mv projects .metadata\.plugins\org.eclipse.core.resources\.projects

Use at your own risk, of course.

11
  • 11
    Worked for me too (BTW, to be safe you can always "mv yourContents yourContents.bak" instead of deleting them). May 10, 2010 at 21:38
  • 6
    Actually, this removed all subclipse functionality from my projects, probably because they are no longer associated with a repository. I had to restore from backup.
    – Muhd
    May 21, 2011 at 0:03
  • 3
    Worked for me only: closing Eclipse, moving the folder to another location, restarting Eclipse, closing Eclipse, moving the folder to original location.. I don't know why..
    – gc5
    Jan 17, 2013 at 13:19
  • 10
    I managed to solve this problem by deleting .metadata\.lock - this file existed after I closed/killed eclipse, but when I deleted, the build was working.
    – maestro
    Mar 5, 2014 at 15:09
  • 3
    don't forget that these paths are for windows, for linux use / instead of \
    – ACV
    Mar 22, 2016 at 21:13
28

eclipse -clean did not work but following did:

eclipse -clean -clearPersistedState
5
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
    – Politank-Z
    Jun 21, 2015 at 1:24
  • 8
    On the contrary, my answer does respond to the question, I had the exact same issue, tried multiple solutions, the one I posted was the only that worked. Jun 22, 2015 at 17:09
  • 8
    Note: this also resets your eclipse workbench perspectives. Nov 4, 2015 at 11:35
  • It works for me. However it didn't work at first time but before tried again I just deleted the .lock file from .metadata folder and run eclipse -clean -clearPersistedState again so it worked perfectly. :) Aug 23, 2017 at 8:42
  • It resets the perspectives, it is worth :) Nov 30, 2020 at 12:04
27

Sometimes it's very helpful to execute Eclipse from command line with the -clean parameter to force it to clean up the workspace.

2
  • 1
    AFAIK, it has nothing to do with the workspace. It cleans the plugins cache. You will notice that the startup time before asking for the workspace is much longer. After the workspace is specified, it is the same.
    – zvikico
    May 12, 2009 at 9:42
  • 1
    Not only. It cleans eclipse cache in general, so every unrelated garbage within workspace will be wiped out as well. May 12, 2009 at 10:05
14

Eclipse often freezes for me at 44% if I'm debugging Android over USB. When disconnecting the device, Eclipse starts.

9

The accepted answer allowed me to get Eclipse started again, but it seems that the projects lost their metadata. (E.g., all the Git/Gradle/Spring icons disappeared from the project names.) I have a lot of projects in there, and I didn't want to have to import them all over again.

So here's what worked for me under Kepler. YMMV but I wanted to record this just in case it helps somebody.

Step 1. Temporarily move the .projects file out of the way:

$ cd .metadata/.plugins/org.eclipse.core.resources
$ mv .projects .projects.bak

Step 2. Then start Eclipse. The metadata will be missing, but at least Eclipse starts without getting stuck.

Step 3. Close Eclipse.

Step 4. Revert the .projects.bak file to its original name:

$ mv .projects.bak .projects

Step 5. Restart Eclipse. It may build some stuff, but this time it should get through. (At least it did for me.)

2
  • FWIW, I've had occasion to use this a few times over the past few months and so far it's worked every time.
    – user41871
    Mar 19, 2014 at 23:24
  • 1
    Perfect, it worked. I got myself stuck in such situations many times and had to wait for a very long time. I tried these steps and it worked. Cheers!
    – Vipul
    Aug 20, 2016 at 14:37
9

Step1:

Open project directory and edit .project file, remove following lines to disable java script validation.

  <buildCommand>
      <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
      <arguments>
      </arguments>
    </buildCommand>

Save file.

Step 2:

Go to Eclipse installed directory and open eclipse.ini(or sts.in if you have STS), change xms and xmx value based on your RAM size of your computer.

-Xms512m
-Xmx1024m
-XX:MaxPermSize=256m

OR: in windows, go to eclipse shortcut in desktop, right click->properties-> add following: C:\software\eclipse\sts-3.6.2.RELEASE\STS.exe -clean -Xms512m -Xmx1024m

Run Eclipse.

Go to Eclipse->windows->preference->Validation, enable Suspend all validators. Do this if you don't want do any validation listed in the list given in Validator panel.

2
  • Eclipse deciding to add a javascript validator to my .project file for a GWT project (LOTS of generated javascript that doesn't need validation) caused my build to be achingly slow... removing that validator did it in my case, cheers. Feb 12, 2016 at 1:36
  • this worked for me thanks, but I have already changed the eclipse.ini file with high values and uncheck all validation from preferences window but i was getting stuck at 67% now after applying the step 1 of your solution it worked.....!! can you point out what's the difference in unchecking from preferences and deleting from file (i.e. your solution)
    – SSH
    Aug 17, 2017 at 7:46
9

I have this problem whe I have too much maven projects open at once. What I tend to do is:

  • Restart eclipse (sometimes I need to kill eclipse)
  • Disable automatic build immediatly (project > uncheck Build automatically)
  • Right click the project(s) I want to have rebuild
  • Close unrelated projects
  • Re-enable automatic build

This enables a functioning rebuild in 99% off the cases in my workspace.

1
  • Just disabled the build immediatly seem to have fixed the hang loop.
    – Rushino
    May 6, 2019 at 15:24
7

You may want to take a look at How to report a deadlock. You may also want to check the Error view and/or the error log ([workspace]/.metadata/.log). If that doesn't help, you'll probably need to include more info about which plugins you have installed and which projects you have. Can you create a minimal workspace which reproduces the problem?

4
  • the problem is intermittent so it gets really annoying. But ok, let's see if i can get more info about the problem.
    – sean
    May 10, 2009 at 6:50
  • 1
    It is possible that just creating a clean workspace and importing the projects will solve the problem. It's worth a try in any event.
    – zvikico
    May 12, 2009 at 9:45
  • 13
    This doesn't answer a question at all. @JamesBeninger provided maybe not ideal but workable solution below
    – Dima
    Apr 19, 2012 at 17:03
  • Go to Window - Show View - Other - General - Error Log from the file menu in Eclipse. You can also get to it from Help - about Eclipse - installation details - configuration tab - View Error Log button. Feb 23, 2018 at 21:03
5

I faced Similar issue in Eclipse Indigo. I changed the HeapSize it started working correctly. I just added following eclipse.ini file -vmargs -Xms1024m -Xmx1024m

It worked fine after increasing the VM size

0
5

The only solution for me (Luna 4.4.1) was this:

Go to Project Properties > Builders and then uncheck the Javascript Validator.

2

I had same issue with my Eclipse and as a solution, I created new project, copied all resources manually (using windows copy/paste) to new project, deleted old project and that's it.

Sometimes, this happens due to improper System shutdown and Eclipse workspace started facing similar issues.

Hope it will work.

1
  • I've just moved most of the resources away, restarted eclipse, copied them back.
    – xmedeko
    Apr 3, 2014 at 19:54
0

I just had the same problem.

By using Task Manager to kill the build process and exiting Eclipse with no projects open, I was able to get back into Eclipse and clean the project without opening it. I then restarted Eclipse again,loaded my project and all OK.

0

Unselect automatic build using Eclipse-> Windows->Preferences helps fixing this issue.

1
  • This is a likely issue with a corrupted cache. Whether the projects build is another question altogeher.
    – mlissner
    Mar 28, 2013 at 17:25
0

I've found that this might also happen if you rebuild a workspace with a project containing a lot of image data (such as a dedicated images project). Might be best to put something like that into its own workspace and handle it separately to the rest of the projects you deal with.

If you can't, then don't clean that project when you clean and rebuild. Only rebuild when necessary.

0

In my case problem arise after importing downloaded project - stuck at 80% build. Solved by adding write permissions for group to project's files (Ubuntu 12.04).

0

In my case it helped to remove the source folders from my favorites in the Windows Explorer (Windows 8.0). It seems that the build was not actually stuck, but triggered in some kind of infinite loop (as mentioned here - Bug 342931).

0

Sometimes the problem seems to be fixed by killing other programs which have files open from the project folder.

0

Looking at the logs in [workspace]/.metadata/.log provided useful information for me. Turned out there was a java.lang.OutOfMemoryError: PermGen space error when the workspace build would hang. This can be edited in the eclipse.ini or sts.ini(If you are using SpringSource Tool Suite) file.

0

I faced the same problem when I tried to install Angular.js with bower in my project. I seems bower has lots of javascript files it downloaded automatically which caused my IDE to stuck in validation process for a long time. So, I solved this problem this way,

  • I first installed tern.js 0.9.0.
  • Then I went to the project properties, selected tern script path included only the path I needed for validation, My project's javascript folder. I excluded other path like placeholders, Angular.js files, Jquery files.
  • I selected the Javascript from the properties again and did the same things in include path's source.

My IDE currently working without freezing. I took help from there. Tern I guess it can be helpful, where any IDE stuck due to lots of Javascript file.

0

I tried lots of these suggestions, but the only thing that finally worked for me was creating a new workspace, and freshly checking out all my projects into that folder. Then it worked fine ;-)

0

I just restarted eclipse and it started working the next time.

0

Refresh all the projects u want to build. Worked

0

Restart eclipse.
It worked for me several times.

0

I was able to solve this by removing extra folder that Eclipse had created in my eclipse installation folder. I didn't install and I was using Eclilpse Neon 3 with Spring Tool suite also installed. But, when I looked into extracted eclipse installation, I had C: folder which had some folder structure. It was mirror image of my Downloads folder. I removed it and restarted.

It worked for me!

0

None of the the answers here worked for me. What worked was to delete the following folder

C:\Users\your username\workspace\project name.metadata.plugins\org.eclipse.core.resources.projects\project name\.indexes

0

Rather than debug and find the exact root cause(s) for this, I just deleted the projects and the metadata folder. Eclipse will rebuild the .metadata file the next time it's launched.

I then pulled in the latest project code and the problem was solved. It was more work as I had to reconfigure everything, including my servers, but build workspace had been stopping at 50% for anywhere from 3 to 5 minutes before it would completely finish, so it was worth the effort.

Also, I've found that with Eclipse, if you stop the build workspace before it completes and shut down Eclipse if that hangs up everything, you can really mess up your configuration and waste lots of time trying to get it stable again. I'm using Eclipse Oxygen, but I've had this happen in all the versions of Eclipse I've used, so I really try to avoid it, if possible.

0

Inside the project folder open .project file. There is a bad entry and it might help

    <buildCommand>
        <name>org.eclipse.m2e.core.maven2Builder</name>
        <arguments>
        </arguments>
    </buildCommand>
0

In case there is a problem on start when building your project disable the build automatically from menu. Project -> Build Automatically. This solved my problem while more sophisticated solutions could not.

0

This can also happen if you have an empty java file that is named and classpath-located exactly like another java file (which can happen when resolving merge conflicts for moved resources).


For example, the following setup causes this issue in a multi-maven module:

  • module1/src/main/java/com/package/MyClass.java (empty)
  • module2/src/main/java/com/package/MyClass.java (actual valid class)

To fix, simply delete the empty java file.

0

Deleting some of the JDT indexes (in .metadata\.plugins\org.eclipse.jdt.core), particularly the big files, often fix or ease the problem for me.

Not the answer you're looking for? Browse other questions tagged or ask your own question.