Eclipse Performance Maintenance - eclipse

Is there a cache or something that needs be cleared periodically?
Eclipse has been running pretty badly lately, especially with regards to open files and switching between them in the editor.
Frustrated and confused.

There is nothing that you as a user need to run periodically to keep Eclipse performing. I would guess that you are seeing performance problems due to Eclipse process hitting its allowed memory ceiling. Take a look at your eclipse.ini file and update the -Xmx setting. Don't crank it up too high as that can keep your Eclipse from starting.

You can delete old configurations. This might speed up start-up time, but I'm not sure. Ignore the revert highlight on the image. What you need is the delete button that appears in later versions of Eclipse next to it. Delete everything but the current installation configuration.
To access, go to Help > About Eclipse SDK > [Installation Details] > Installation History.
Also, make sure you have projects other than the one you're working on closed. Doing this reduces the size of the in-memory Eclipse workspace model.

Also make sure projects that you are running are shutting down correctly (or manually terminate them). I have found times that a project I was testing did not end after an error and I had 10 instances of it running in Eclipse, I had to select the console and manually end it. (Closing and opening Eclipse also frees things like this up).

You can give more memory to it , modifying eclipse.ini file. For example:
-vmargs
-Xms384m
-Xmx768m
default ones 256-512m.

Look here for optimal JVM settings when running eclipse

Sometimes if you've had the workspace for a very long time eclipse would run slower, delete the old workspace and then create a new one, importing the project into it again (Make sure to check in or backup your code first).
I wouldn't really recommend tampering with the eclipse JRE runtime parameters. But if you are at liberty to update eclipse, I would recommend you update it to the latest version.
I've added some tips that could help improve the performance of eclipse in an answer to a question.

Related

Eclipse Freezes Constantly

I've heard rumors about "Eclipse's minute of silence", but I had no idea how bad it is.
I've installed a brand new Eclipse (from a ZIP package) and only installed the JBoss tools. Now Eclipse freezes at close to each key shortcut, but at least once every 30 seconds. Ctrl+C? One minute Freeze. Doesn't copy. Ctrl+D? One minute freeze. Also, doesn't delete any lines. Clicking into an editor? One minute freeze. It also takes everything with it, so e.g. my browser won't work while Eclipse freezes.
It is not possible to work like this. At all. My colleagues just went back to Eclipse 2018-09, but I need Java11, so I can't.
I could not find any bugs for this issue (a lot of bugs for Eclipse freezing, but none that should still be present in 2018-12).
Anyone else experienced something like that? It's our entire office, so it's not just one faulty computer. Could it have something to do with how Eclipse scatters its config files over the hard drive? Maybe it can't read the 2018-09 config files or something?
If you use the Project Explorer, this could be caused by bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=536918 which is already fixed for Eclipse 4.11 (and will be released as Eclipse 2019-03 in March)
You can use an integration build from http://download.eclipse.org/eclipse/downloads/
As workaround, it might also help to to close the Project Explorer View (in all perspectives) and use the Package Explorer instead.
As others have written, it might also be a memory issue. Open the Eclipse Preferences and
in the General section enable Show heap status so you can see it at the bottom of the window.
If this is the problem, edit eclipse.ini and increase the memory settings (open eclipse.ini and increase the number of the line with -Xmx. If you have a mac, right-click on the Eclipse Application, choose Package Contents, find it at Contents/Eclipse/eclipse.ini)
I was facing this "lagging"/"freezing" issue in Eclipse 2018-12 until I did this.
in eclipse.ini
-Xms256m
-Xmx4096m
Of course it has not stopped "freezing" completely, but The number of times has been tremendously dropped.

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 slow text file opening

I have had this before and after switching computers and a long time of happy developing, I'm having it again: Eclipse taking extremely long to open simple text files.
What's happening, what's changed is:
Tomcat now requires frequent restarts / reloads even changing Javascript files
text files take at least 30 seconds to open
My environment is:
Mac OS Maverick
STS 3.4.0
Sysdeo Tomcat
Maven project nature
AspectJ capability
Android development tools
Gradle IDE
I realize that reinstalling Eclipse/STS would be an option, but in stead of taken half a day to get it just right again, I would prefer to just fix the problem. Any ideas?
Is there any way to trace where eclipse is spending its time, some kind of high level debug output?
Well, after removing *.js from the file associations, the problem seemed to go away. After that I readded it again and everything was good again. Thanks #Cristophe for pointing me in the right direction

Eclipse intermittent "cannot be resolved to a type" error

I keep running into a strange intermittent issue with eclipse for the past few days where I will be editing code, save it, and then eclipse starts reporting hundreds (or sometimes thousands) of MyClassName cannot be resolved to a type errors. The errors are completely bogus as the classes do exist, and if I do a clean and rebuild on the entire workspace the issue goes away. This is the second workspace in a row that it has suddenly happened to.
Has anyone else ever run into this before? Is there some way to fix this issue without recreating an entirely new workspace (which is extremely frustrating). I'm not entirely sure what keeps happening to seemingly corrupt my workspaces.
[Update]
For clarification this is happening with multiple projects that are all Java (web application) projects using only the standard 'Java Builder.'
Debugging Eclipse gone wrong is a painful task. I make it a routine habit to reinstall it, sad but true. The Eclipse Plugin framework tends to lead to these kinds of interactions . You don't mention what version of Eclipse and if it is EE or standard.
So, I'd suggest you try a fresh install of Eclipse. Another thing to try is change the JVM you are using to run Eclipse. The most widely used and tested JVM is still Sun/Oracle Java6.
I have had the best results using the standard version of Eclipse and only adding the EE stuff as needed, ie the Web Developer Tools.
If this happens on Windows with a virus scanner being installed, you may want to try excluding your workspace directory from the on-access scanner. I have two colleagues who get very annoying (and not reproducable) build errors quite often, as long as their TrendMicro virus scanner is enabled.
Happened to me with Eclipse Neon after git merge with multiple confilicts, I solved the issue with deleting and re-importing my project.

eclipse stuck when building workspace

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.