eclipse stuck when building workspace - eclipse

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?

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.

Some time it's very helpful to execute eclipse from command line with "-clean" parameter to enforce it produce clean up for workspace.

eclipse -clean did not work but following did
eclipse -clean -clearPersistedState

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

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.)

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.

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.

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?

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

The only solution for me (Luna 4.4.1) was this:
Go to Project Properties > Builders and then uncheck the Javascript Validator.

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.

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

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.

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.

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.

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).

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).

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

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.

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.

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 ;-)

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

Refresh all the projects u want to build.
Worked

Restart eclipse.
It worked for me several times.

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!

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

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.

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>

If you are using Maven as a build tool you might want to:
Close eclipse
Delete dependency directories located in .m2/repository/ - in
Linux
it's located under Home directory and in Windows it should be in c:\Users<YourUsername>.m2 (replace '' with your
username)
Start Eclipse and enjoy normal work :)
That helped me resolve this issue and I hope it helps you too. :)
Cheers!
P.S. I've edited my answer (as #howlger asked) where it was also suggested to delete .eclipse and .p2 folders as it can do harm (although it did NOT in my case + I had to reinstall some of plugins I'm using).

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.

Related

Eclipse hangs on reverting resources

I use eclipse Indigo, subclipse 1.10.x and javaNL. Whenever I try to refresh my project in eclipse, it gets stuck at Reverting Resources 0% and Computing Update Requirements 0%. I try to kill eclipse and reopen the project and it still does the same. I do not understand why this happens. It started happening recently. Before it was working fine.
Question: I do not understand why this happens
General Answer: http://www.ihateeclipse.com/
(I may share this opinions and dont think Eclipse should be called a IDE but that wont fix your problem - hence lets proceed with possible workarounds).
Possible Workarounds:
1.) Starting eclipse in clean mode How to run eclipse in clean mode? and what happens if we do so?. (This solved aprox. 80% of my continuously returning 'I messed up my own state' issues I experienced).
2.) If that doesnt help - you would have to stop eclipse, identify the according files (or just any files holding such information) and delete them manually, then restart eclipse. Like I still encounter issues with my "Search Type" (Ctrl+T) and have to delete the files like described here Eclipse type hierarchy not always working (unfortunately I don't know anything about files regarding your current issue - so feel free to downvote my "answer" since its not directly answering your question).
The best things I found about "the full reset" seem to be: http://letsgetdugg.com/2009/04/19/recovering-a-corrupt-eclipse-workspace/ or http://blog.pdark.de/2011/09/02/restoring-a-corrupted-workspace-in-eclipse/ (Note: I haven't verified the described behaviors).
3.) Recreate Workspace - delete any eclipse belongings like the .metadata folder and keep only belongings of your project (e.g. sources, resources etc.). Then create a new eclipse project based on you existing project sources).
4.) If Steps 1-3 failed consider reinstalling Eclipse (include above Step 3 in this process again) or switching to a proper IDE that can at least handle its own state.
5.) I experienced rare cases where in the end such things were triggered by me rather than occurred magically out of nowhere by eclipse - I don't see any possibility on how you could manage that in your case unless you messed around with the eclipse source itself).
Hope this helps - Even thus the SO community is big I experienced way better results asking the eclipse developer community directly when it came to such specific issues (you however oftenly get a link to a open Bug ... that they created because of your question) and ended up "just importing into a new eclipse workspace from existing sources" whenever I experienced such issues lately (It takes me about 5 minutes to checkout our sources, start Eclipse with -clean as default and import existing Maven projects solving any eclipse-only issue - while each of those eclipse-issues can take days to be solved without any further advantage for my daily business)
I don't know if this will help any one but I had the same issue. Some links advised me to delete my metadata, which I did not want to do.
What fixed it for me was:
I have multiple eclipse workspaces, I manually closed my eclipse using the System Monitor/Taskbar as it wouldn't let me close as it was hanging.
I switched workspaces and it seems to run fine. So I switched back to the one that was hanging and the problem seemed to have gone.
This worked for me:
Go to to your workspace instalation, and manually delete the target directory under your maven projects (dont worry , maven will create another one when compiling). This removed my stuck Eclipse state (thread) in "Revert sources", always at 0%.
this helped me:
delete files "*.snap" under org.eclipse.core.resources in
worskpace/.metadata/.plugins/org.eclipse.core.resources/
and share project again (setup SVN settings)
I accidentally checked in target files to SVN. And the target files were huge ans hence it was stuck on reverting resources. Once I deleted those target files from SVN this issue never happened.But JBA's answer is pretty comprehensive so I will mark that as a right answer.
I have this same issue, and I just quickly cancel the "Rerverting Resources" task while it's in "waiting" mode when restart Eclipse.
This should work to 100% and helped in my case (no other tried solution worked):
Go to "Eclipse > Help > About Eclipse IDE > Installation Details
Uninstall the following packages "Subclipse", "Subclipse Integration for Mylyn", "Subversion 1.14 JavaHL", "Subversion Revision Graph", "SVN Client Adapter".
pluginsToUninstall
Go to the marketplace and install "subclipse" again.
Rightclick on your project > Team > Refresh/Cleanup
You are welcome. :)

Eclipse Juno Not Loading - stuck on 'org.eclipse.m2e,core'

I was working fine with an Eclipse Juno on a Maven java project - all hunky-dory for couple of weeks.
Yesterday, just before leaving for home, I ran 'mvn clean' and 'mvn install' on the command line for the project (all good). I did not try opening Eclipse after running 'mvn' on said project from the command line.
This morning opening Eclipse Juno does not work - it stalls on loading 'org.eclipse.m2e,core'.
Can anyone give guidance on what could be going on?
I would rather not delete Eclipse and re-install - too painful!!!
I am using Macbook with Oracle JVM 7.
Delete the folder ".org.eclipse.e4.workbench" in ".metadata/.plugins" within the problem workspace and start eclipse with the -clean flag.
If this doesn't help also delete all files ".markers.snap".
I just have to delete the file workbench.xmi from directory
[*workspaceXYZ*]/.metadata/.plugins/org.eclipse.e4.workbench
Then the workspace starts again. But this is really a pain...
Just adding extra case for same old problem (as i encountered the problem now and was able to solve it):
For me too i had exactly same problem, other work space were working except for this. I did not wanted to delete this problematic workspace. So what I did was, first I loaded some other work space for which eclipse starts. Then I clicked "switch work space" and tried to open the same work space which had was problem. Then it worked
You can try steps in this answer. This didn't work for me so then I tried deleting the whole workspace/.meta folder. This did work for me but I now have to reimport my projects - so not perfect.
Seems your eclipse in doing something with M2E the maven plugin, maybe try to remove the plugin from eclipse installation first. Then try to restart eclipse.
If everything is ok, then install the plugin agian.
To me was necessary to do both solutions above:
Delete the folder ".org.eclipse.e4.workbench" in ".metadata/.plugins"
I loaded some other work space for which eclipse starts. Then I clicked "switch work space" and tried to open the same work space which had was problem.
Then it worked!!! :D

Eclipse IDE does not start

My computer suddenly shut down due to power failure, while I was working on an Android project using my Eclipse Indigo IDE.
Now, if I start Eclipse, only an empty message dialog (see screen shot) appears and Eclipse does not start. What can I do?
(I am using Ubuntu 12.04 LTS)
Mabe Some files found in the .metadata folder of your workspace are damaged, have you tried to launch it by specifying another workspace?
You can manually specify the workspace location on the command line, using the -data command-line argument.
If you don't want to loose a lot of time by trying to fix the problem, you can import your projects into the new workspace, reinstall the plugins that was installed before and everything will be ok. otherwise, you have to take a look on the .log file found in the .metadata folder of your old workspace, analyse the stacktrace and try to understand which plugin is corrupted and delete it manually, and this may take a lot of time, thats why i suggest you the first solution. About the .metadata folder, it is in ~old_workspace/.metadata.
check your filesystems. Maybe something got corrupted when power was lost.
Check my blog post When Eclipse Won't Start and Restoring a Corrupted Workspace in Eclipse
For me, .metadata files were damaged. Since eclipse was not opening at all, changing the workspace was not an option. I deleted following directories, and could start afresh!
.metadata
.buildpath
.project
Hope this helps you as well.
Please note that you will end up loosing all the project settings.
I know my reply is too late. Hope this helps another user.
My Ubuntu in the VMware was shutdown abnormally for some reason. When I logged back in Eclipse would not start. I fixed with the following steps:
removed .lock file in the .metadata folder in the workspace
started eclipse using command line with "-clean" argument
It started fine!!!
I tried to find the corrupted file by removing the files from ~/workspace/.metadata/ one by one until Eclipse could start.
The corrupted file was ~/workspace/.metadata/.plugins/org.eclipse.core.resources/.snap
Once the file was removed Eclipse started normally.

Eclipse: The project was not built since the source file ... could not be read

When compiling my Java project, I get this error in Other errors:
Description Resource Path Location Type
The project was not built since the source file /PROJECT/src/main/org/../ABC.java could not be read PROJECT Unknown Java Problem
Indeed, the file is listed in Package Explorer but shows only "Error retrieving content description. On the file system, the silent dir exists but not the file; git status is missing nothing. How do I resolve that compile error?
Simply restart eclipse, refresh all projects and do a clean build. That should fix it. Don't forget the eclipse restart, else no matter how many times you do a clean build or refresh, it will not fix the problem
Looks like someone has deleted that file but eclipse still think that file is part of the project. Might have happened when someone deleted a file from the source control in an improper way.
If you dont have pending changes then you can get fresh copy of the project and import it into your workspace.
If you have pending changes then take a copy of changes and repeat above step. ( A restart of eclipse may be necessary)
It can be related to missing location
Select File => properties => Resource => Edit file location.
I know the answer is accepted but in my case that solution didn't work for me, I had restored files from a backup to my local project in linux and the files I restored were owned by root with only the owner being able to read/write the files. SO, I sudo chowned the files "sudo chown _R myUser:myUser *" at the base of my project, refreshed in Eclipse (f5) and the annoying repeated failure of my build was a thing of the past.
If you are writing Maven projects, try right click on the project and select [Maven] -> [Update Project...]
It works for me.
For me there was a different solution than mentioned here.
I was doing a no-no, I imported a project that had a .project file, and there was some errors in the way my version of eclipse was reading some of the files. The package names and files had a little ! symbol with a yellow background.
The solution was to delete the packages. Obviously make a backup. But in doing this most times the files nor the packages were deleted. Instead eclipse refreshed and the desired files were there. Sometimes I had to hit refresh (F5), and sometimes I had to restore files.
I found it best to delete the packages as that is where eclipse was having reading the data.
If the missing file is still mentioned in the Linked Resources, no refresh and restart of Eclipse will ever solve the problem. You have to delete the file in the Project Properties Linked Resources list.
For anyone using VS Code with the RedHat Java plugins (which use Eclipse tooling under the hood), I got this error as well. I fixed with the following:
# Quit VS Code
rm -rf ~/Library/Application\ Support/Code/User/workspaceStorage/*
# Reopen VS Code
As all others said, it is most probably an issue with the internal caches of Eclipse.
I usually restart the IDE with the additional -clean option to wipe out the OSGi-related caches, then clean and rebuild all the projects.
If the problem persists, I realized that cleaning up the single affecting project works better that cleaning up the whole workspace. (Ominous... XD)
This usually happens to me when merging changes that imply renaming or deletion of source files, prior to launching Eclipse.

(Eclipse) Hangs when building project: copying resources to output folder

This has been happening intermittently, but now its consistent.
When I go to build the project, eclipse just hangs forever at this step:
copying resources to output folder
I saw a suggestion to remove all non-java resources from the project and put them back in one at a time, but that is impractical for the size of this project.
I was able to resolve this by using the following steps:
1) Closing eclipse - In case it does not close - Kill the process
2) Manually delete everything in the output folder
3) Start eclipse with -clean option -> eclipse.exe -clean
Hope this helps!
I ended up using a new workspace. A new eclipse instance didn't fix it. A new workspace and the old eclipse worked fine.
I just had the same problem, but now I've solved it.
The cause was not one really large file, but a lot of small files adding up to a large total.
For me it was not a problem to move these files, since in hindsight they didn't really belong there anyway.
i just had the same problem, my problem was that i added an wrong/to large folder with sources and added it for the source-lookup. so eclipse tried to go through hundreds of jar-files on each build.
removing the wrong parent-folder from source-lookup-path fixed my problem.