Eclipse

Eclipse Quit Unexpectedly: Troubleshooting

In this article we will see the various reasons Eclipse can die unexpectedly and we will also examine the solutions for that. For this article we will make use of Eclipse Luna 4.4.2 and Windows OS. Few of the things might be different in your case if you are running Eclipse on Mac or Linux.

1. Introduction

Eclipse is one of the most commonly used IDE by Java developers. Though Eclipse can be also used for developing applications in other languages (e.g. PHP, Perl, Python, Ruby, C++ etc), it is mostly being used for Java development. The best part of eclipse is that you can add features as required by using plugins.

2. Reasons and Solutions

In this article we will see the scenarios which could lead to Eclipse quitting unexpectedly and then we will see the solutions for those scenarios.

2.1. Faulty Plugin

Let’s say that you are working on some piece of work which requires you to install a new plugin. You make use of the Eclipse Marketplace to install a new plugin. You can read the article to understand how to install an Eclipse plugin from here. Once the plugin is installed, Eclipse will ask you to restart your IDE. You restart your IDE, but then all of a sudden your Eclipse crashes. Now assuming that your eclipse was working fine before, chances are that the plugin which you have just installed is corrupted or incompatible. Normally the chances that it is incompatible with your current version of Eclipse is very low as when you are searching for the plugin, Eclipse will tell you whether that version or plugin is compatible or not.

The quick and easy way to confirm whether the problem is with the plugin or not, is to uninstall the plugin and restart you Eclipse. If now you Eclipse is working as expected, then you are sure that the problem was with the plugin.

2.2 Incorrect Java version

One of the common reason of Eclipse crashing is incompatible version of Java. If you have recently installed a new version of java or an update to the existing version and you find out that Eclipse has stopped working then chances are that the version of java you have installed in not compatible with the installation of Eclipse you are running. Now to get to the bottom of it, you can read the readme_eclipse.html file which can be found at the readme folder in you Eclipse installation directory. There you will find the information about the version of java which you need. For example for my version the readme file says:

In general, the 4.4 release of the Eclipse Project is developed on a mix of Java SE 6 and Java SE 7 VMs. As such, the Eclipse SDK as a whole is 
targeted at all modern, desktop Java VMs. Most functionality is available for Java SE 6 level development everywhere, and extended development
 capabilities are made available on the VMs that support them.

It will also gives you lots of other details as well. There are two ways to handle this situation. The first method is to uninstall the newly installed version/update of java and verify that Eclipse works correctly. The second option is to upgrade to a new version of Eclipse. Before upgrading you need to make sure that the particular version of Eclipse is compatible with the version of java you have installed.

2.3. Memory Setting

This is also one of the main reason for this problem. Sometimes when you run a memory intensive application in Eclipse and Eclipse run out of memory then you can get this issue. To increase the memory open the eclipse.ini file present in the Eclipse setup folder. Look for the properties -Xms, -Xmx and XXMaxPermSize. If they seem to be quite low then increase it and try to run the application again.

Figure 1. Eclipse ini

Some JVMs put restrictions on the total amount of memory available on the heap. If you are getting OutOfMemoryErrors while running Eclipse, the VM can be told to let the heap grow to a larger amount by passing the -vmargs command to the Eclipse launcher. For example, the following command will run Eclipse with a heap size of 256MB:
eclipse [normal arguments] -vmargs -Xmx256M [more VM args]

You can read about these in more details here

2.4 Misc

If none of the solutions mentioned above can fix this issue, then you can try few other things which are mentioned below:

  • Try refreshing your project. To refresh the project, right click on the project and select ‘Refresh’, or select the project and press ‘F5’
  • Try cleaning you project. To clean the project go to Project=>Clean.
  • Try to use a different workspace.
  • If you are running Eclipse on Mac you can try cleaning the workspace. Open the Terminal and go to the location where eclipse is installed. Then run eclipse from the terminal like $./eclipse -clean

3. Conclusion

In this article we saw some of the main reasons which could lead to Eclipse quitting unexpectedly. We also saw the steps which we should follow to resolve this issue. This is not a very common problem but if it happens it might get tricky to find the root cause.

Mohammad Meraj Zia

Senior Java Developer
Subscribe
Notify of
guest

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

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Felipe Sebastiani
5 years ago

I downloaded today Eclipse 2019: Version: 2019-03 (4.11.0), Build id: 20190314-1200 and I configure it with Java Open JDK 11, but the IDE always had closed unexpectedly.

So, I followed this tutorial and the answer was the memory, I had to increment the amount of memory and I can work without problems.

My eclipse.ini contains this configuration:

-startup
plugins/org.eclipse.equinox.launcher_1.5.300.v20190213-1655.jar
–launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1000.v20190125-2016
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
–launcher.defaultAction
openFile
–launcher.defaultAction
openFile
–launcher.XXMaxPermSize
openFile
–launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
–add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms512m
-Xmx2048m
–add-modules=ALL-SYSTEM

Back to top button