How To Solve Eclipse Building Workspace Too Slow Problem

When you develop a java project using eclipse, you may find that the eclipse project runs so slowly, this can even stop your work, you can do nothing but wait for the eclipse project to build or download maven jar files to complete. Why is eclipse so slow when building a workspace? This article will tell you some tips about how to avoid eclipse building workspace slow issues.

1. Uncheck Project Auto Build.

  1. If you check the project auto-build menu item, the project will build automatically every time when you change the source code.
  2. This can slow down your project coding process extremely. So please remember not to check the Build Automatically menu item.
  3. Below are the steps to disable auto-build for the eclipse project.
  4. Click the eclipse Project menu item at the top menu bar.
  5. Click the Build Automatically sub-menu item to check or uncheck it.

2. Increase Eclipse Used Memory Size.

  1. Eclipse used maximum and minimum memory sizes are configured in the eclipse.ini file. You can find this file in the eclipse installed directory.
  2. If you use eclipse on macOS, there is something different, you can read the article How To Change STS Eclipse INI File On macOS to learn how to change its content for macOS.
  3. To make your eclipse project build faster, increasing the eclipse used maximum memory size is a method. Below are the steps.
  4. Open the eclipse.ini file in a text file editor.
  5. Add or change the below data.
    -vmargs -Xms256m -Xmx512m

3. Reduce Auto Startup Plug-in Number After Eclipse Startup.

  1. If you reduce the auto startup eclipse plugins number, this can save a lot of time when eclipse startup.
  2. Click Eclipse —> Preferences ( macOS) or Window —> Preferences ( Windows ) menu item to open eclipse preferences dialog.
  3. In the popup Preferences dialog, click the Startup and Shutdown item in the left panel, or search the keyword startup and shutdown in the top type filter text input text box to find it.
  4. Then you can select the plugins that you want to be activated when eclipse startups on the right side Plug-ins activated on startup list panel.

4. Reduce Build Process Required Validators To Speed Up Compilation.

  1. In development, when you find the eclipse workspace build process is slower and slower, and if the main reason is because of validating static files ( for example validate JS, CSS, XML file, and so on). Then you need to reduce or remove the validators in the eclipse preference validation section.
  2. Open eclipse preferences dialog.
  3. Click the Validation menu item in the left panel ( or search the keyword validation to find the menu item ), then you can enable or disable the related validators by selecting/deselecting the checkbox in the Build column on the right panel. If you check the checkbox in the Build column, then the validators will be executed when you build your project, this can decrease the build speed very much.

5. Exclude JS Files From Validation.

  1. If there are big JS files that exist in your java project, and you do not want to validate the JS file content, you can exclude the JS files from validating it.
  2. Right-click the eclipse java project, and click the Properties menu item in the popup menu list.
  3. Click the JSHint menu item in the left panel ( or type the JSHint keyword to filter it out), then add excluded js files or folders that do not need validation in the right panel.
    edit-eclipse-jshint-to-exclude-js-files-from-validation

6. Remove Eclipse Local History Folder.

  1. Eclipse workspace has a local history folder, this folder is used to track all the changes that happened to this eclipse workspace.
  2. If there are too much data in the eclipse local history folder then it can make the eclipse project run slower and slower.
  3. You can find the eclipse local history data at your eclipse workspace folder .metadata/.plugins/org.eclipse.core.resources/.history.
  4. You can remove the above eclipse local history folder completely to make the eclipse run faster.
  5. You can also change settings in the eclipse local history configuration panel to make the local history folder size smaller.
  6. Click the Eclipse —> Preferences ( macOS ) menu item, then click the General->Workspace->Local history in the popup Preferences dialog window left side.
  7. Then you can check the Limit history size checkbox, and change the Days to keep files, Maximum entries per file, and Maximum file size(MB) value to a lower number.

7. Remove the .metadata Folder Or Create A New Eclipse Workspace.

  1. If you find that your eclipse workspace runs still very slow after trying all the above methods. You can use this final method to resolve the eclipse project run slow issue.
  2. Each eclipse workspace has a .metadata folder, the folder is used to store eclipse and project configuration data such as eclipse plugins when startup or shutdown.
  3. If you remove the .metadata folder, the eclipse workspace will create a new one when it startup again. And all the settings in the old .metadata folder will be removed.
  4. So you can make your eclipse project far away from hanging by following two methods.
  5. Create a new workspace and import all existing projects into it.
  6. Close the current workspace and delete the .metadata folder under the current workspace and open the workspace again in eclipse to create a new .metadata folder.
  7. If you look into the .metadata folder, you can find there is a .log file in it. You can find the detailed reason why is eclipse so slow or crashes from the logging data in this file.

8. How To Clean Up Eclipse WorkSpace Without Remove & Recreate It To Improve Eclipse Performance.

8.1 Question.

  1. Recently I found it is slower and slower when I open my eclipse project.
  2. The only way can resolve this issue is to remove the eclipse workspace entirely and recreate it again, and then import all the eclipse projects into the new workspace.
  3. But I do not want to do it in this way I want to know if there is another way to clean up my eclipse workspace and do not need to remove the workspace and create it again.

8.2 Answer1.

  1. All the eclipse changes are saved in a local history directory.
  2. The local history directory path is something like .metadata/.plugins/org.eclipse.core.resources/.history.
  3. If the .history folder contains so much historical data, then your eclipse workspace will run slower and slower.
  4. You can try to remove the data in the above .history folder or remove the .history folder entirely.
  5. But after some days you may find the .history folder data will become bigger again.
  6. So after you remove the .history folder, you need to reduce the saved history data days number, then eclipse can store fewer days history data in that folder to reduce the .history folder saved data size.
  7. You can go to the eclipse Preferences->General->Workspace->Local history to configure it.

9. How To Fix Eclipse Always Refresh Workspace When Start-Up.

9.1 Question (2022/05/23).

  1. When my eclipse is started up, it always takes some time almost 10 minutes to refresh the workspace, I can see this process on the status bar with the message “Refreshing workspace…“.
  2. And during the eclipse refreshing workspace process, I can not operate the eclipse GUI.
  3. How to configure it to make eclipse not refresh the workspace when starting it up, or at least reduce the refresh time duration? Thanks.

9.2 Answer1.

  1. If your eclipse workspace contains so many opened or activated eclipse projects, this issue may happen.
  2. So when you start eclipse, it will sync each of the active eclipse projects one by one which may cost so many times and make your eclipse GUI stuck.
  3. What you can do is close all those eclipse projects that you do not need to develop and only open the projects that you are editing.

6 thoughts on “How To Solve Eclipse Building Workspace Too Slow Problem”

  1. Anthony Dearborn

    Thank you very much, your solution fix my issue. I remove the whole workspace and recreate a new workspace, and then import all the java projects into the new workspace again. This make my eclipse run faster again. But how can I do this by not recreate the workspace everytime, is there any cache folder in the old eclipse workspace that make the eclipse so slow?

  2. Thank you very much !
    I have an old project, whose size is 225Mb, where most classes have the whole body commented. In the past it was not used versioning of code in the company and the same was done in the code itself, commenting a line and writing the change in the line below.
    Can all of these classes cause slowness in eclipse?
    I ask because when I open this project the eclipse is very slow.

    1. You can remove all the comments line in the java source code and try again to find why is eclipse so slow, if your eclipse project still runs slow, it is not the reason. Be careful, you should first backup all your files, and use a tool to remove all the comments. Wish this can help you:)

  3. Thank you very much ! It helped me after a so long time searching a solution to fix this problem with Eclipse. I disabled all the plugins I’m not using and now it’s not spending time anymore building and building. And the memory using by Eclipse is low.

    You are the best 🙂

  4. Cleydyr Albuquerque

    Thanks for sharing those tips! Some were known to me (like the one on memory settings) but I have missed it out because of an Eclipse upgrade (and then it was on the defaults). The others I applied on my environment. Let’s see how it goes.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.