Eclipse

Eclipse Not Starting: Troubleshooting

In this article we will see the various issues which a developer faces when using Eclipse IDE. In particular we will focus on issues when the Eclipse is not starting and will try to troubleshoot the problem. For this example we will use Eclipse Luna 4.4.2.

1. Introduction

Eclipse is the most common IDE used by Java developers.  It contains a base workspace and an extensible plug-in system for customizing the environment. Eclipse is written mostly in Java and its primary use is for developing Java applications, but it may also be used to develop applications in other programming languages through the use of plugins.

2. Troubleshooting

In this section we will discuss various scenarios which can lead to the situation where you are not able to launch the Eclipse IDE.

2.1. JVM options

If you’ve installed Eclipse but are having trouble getting it to run, the most likely cause is that you have not correctly specified the JVM for it to run under. Eclipse startup is controlled by the options in $ECLIPSE_HOME/eclipse.ini. If $ECLIPSE_HOME is not defined, the default eclipse.ini in your Eclipse installation directory (or in the case of Mac, the Eclipse.app/Contents/MacOS directory) is used. eclipse.ini is a text file containing command-line options that are added to the command line used when Eclipse is started up.

All lines after -vmargs are passed as arguments to the JVM, so all arguments and options for eclipse must be specified before -vmargs (just like when you use arguments on the command-line). Any use of -vmargs on the command-line replaces all -vmargs settings in the .ini file unless --launcher.appendVmargs is specified either in the .ini file or on the command-line. The eclipse.ini file looks like something as below:

eclipse.ini

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m

2.2 64/32 bit

Another common mistake on Microsoft Windows is a mismatch between the “bittedness” of Eclipse and the JVM/JDK. This is the most frequent cause of an Error 13. 64-bit Eclipse requires a 64-bit JVM, and 32-bit Eclipse requires 32-bit JVM–you can not mix-and-match between 32-bit and 64-bit, so make sure the version of Eclipse you installed matches the JVM/JDK that you’re using to run it (and make sure you’re using eclipse.ini to specify the exact JVM used to run Eclipse, described above).

As a simple test, open a Command Prompt window, move to the directory that is pointed to by the -vm argument in your eclipse.ini, and run the intended java.exe with the -d32 switch to test if it supports 32-bit, or -d64 to test for 64-bit support. It’s often simplest to download a version of Eclipse that will work with whatever Java you already have installed.

2.3. Exit Code 13

In this section we will try to find out the reason behind the error – ‘Java was started but returned exit code=13‘. First thing to check is whether you are using 32 or 64 bit version of Eclipse / Java. Program Files (x86) is the folder where 64-bit Windows places 32-bit programs. Program Files is the folder where 64-bit Windows places 64-bit programs. This can happen when a system has more than one JVM installed, as is often the case on Windows 64-bit (for example, the JRE download page uses the bit-ness of the browser to determine what bit-ness download to offer you, and many people use(d) 32-bit browsers even though they run 64-bit Windows).

The best way to fix this, assuming you do in fact have 64-bit JRE or JDK on your system, is to specify in eclipse.ini exactly which JVM you want it to use. Specifying the JVM path in eclipse.ini is strongly recommended because doing so isolates Eclipse from any potential changes to your system PATH that some program installers might make

2.4. Exit Code -1

There are a few methods to get more information from this failure and troubleshoot the cause of the problem, but it’s actually worth trying a common solution to this problem first: reducing the Java heap size. In order to reduce the Java heap size, you need to add the -vmargs -Xmx512M options to Eclipse, which can either be done on the command line or by modifying the .ini file in the same directory as the Eclipse executable.

The IBM JVMs offer several mechanisms for getting more data from this event. In this case the best option would be to request the generate a Javadump file when the Java process exits. This can be done by adding the following command line argument to the Java, again using the -vmargs option to Eclipse or the .ini file:
-Xdump:java:events=vmstop

This requests a dump of type “java” (a javacore.txt file) on an event of “vmstop” (JVM shutdown). It’s also possible to specify additional options to specify which exit code to produce dumps on, and where to write the javacore.txt file:
-Xdump:java:events=vmstop,filter=#-1 only produce a javacore.txt file if the exit code is -1
-Xdump:java:events=vmstop,filter=#-1,file=c:\javacore.txt write the file as c:\javacore.txt.

2.5. PATH

Sometimes the issue is with the PATH variable. Confirm that there are not multiple java paths setup in the PATH variable. If for some reason you still want to keep more than one in the PATH variable make sure that the version which you are interested comes first. The PATH variable can be checked by going to System => Advanced system setting => Environment Variables. Also make sure that the variable to pointing to the JDK (C:\Program Files\Java\jdk<$version>\bin) bin location not the JRE (C:\Program Files\Java\jre<$version>\bin) one.

Figure 1. Path
Figure 1. Path

You can see in the Figure 1 that there are two places where you can set the PATH. The top one is user specific and the bottom one is global.

If you have installed update 25 of Java 8 recently you might also face the same issue. One quick solution is to uninstall that update.

2.6. Special Characters

Sometimes the issue could be that the Eclipse path has some special character. Remove those special characters if they exists.

3. Conclusion

In this article we learnt about the various scenarios which could lead to the crashing of Eclipse. We also saw how to fix those issues. Please note that this is not the complete list so there could be other reasons of crashing as well. The ones listed here are the most common ones. So before you dive into more details its worth making sure that the basic set-up is correct.

 

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
vinita
vinita
5 years ago

It was Helpful, Thanks

Back to top button