Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Crash on Launch - JVM terminated. Exit code=2

I will do my best to make my situation as clear as possible. I tried googling the error message, but I haven't found any topic regarding exit code=2 anywhere. I only found topics regarding different exit codes, and I'm trying to fix my issue following the advice given there - no luck so far. Also I'm a newbie when it comes to any form of Linux (the distribution I'm using is Ubuntu).

Problem:

My eclipse crashes on launch with following error window popping up:

JVM terminated. Exit code=2
/usr/bin/java
-Xms40m
-Xmx384m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
-jar /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.dist.jar
-os linux
-ws gtk
-arch x86_64
-showsplash /usr/lib/eclipse//plugins/org.eclipse.platform_3.8.1.dist/splash.bmp
-launcher /usr/lib/eclipse/eclipse
-name Eclipse
--launcher.library/usr/lib/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.dist/eclipse_1503.so
-startup /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.dist.jar
--launcher.overrideVmargs
-exitdata 670018
-vm /usr/bin/java
-vmargs
-Xms40m
-Xmx384m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
-jar /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.dist.jar

There is a big posibility that my problem is related to lack of proper Java version installed.

I suspect this because:

I had eclipse running on my pc two days ago. Yesterday I had to use a web-application which required a specific version of JRE installed. Due to my lack of linux knowledge, I spent a few hours removing my current installations of java JREs and JDKs (so I could install the required version) using multiple guides that I found on the internet (some included commands like sudo apt-get purge java* and other commands including removing, java and *). Today my Eclipse wont launch.

When I run

java -version

it says no such file or directory, but the webpages like http://www.java.com/en/download/testjava.jsp http://javatester.org/version.html do work and say that my java version is

Vendor: Oracle Corporation 
Version: Java SE 7 Update 25 
Operating System: Linux 3.5.0-34-generic 
Java Architecture: 64-bit

installed using this method:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Can someone please guide me how to solve this specific problem? Luckly I haven't made any important projects in my Eclipse yet so I don't mind purging the installation if necessary.

To be completely honest the main reason I need Eclipse for is the Remote Server Explorer option, so if anyone knows a good IDE other than Eclipse that can provide just as good Remote Server Explorer it would be a perfect-fast-temporary solution.

like image 425
Marcin K. Avatar asked Jun 19 '13 18:06

Marcin K.


3 Answers

I got the same error message and solved it by starting eclipse with the -clean parameter. To use the clean parameter: Edit the eclipse.ini file located in your Eclipse install directory and insert -clean as the first line. Once started, remove the -clean parameter in the eclipse.ini file.

It worked for me...

like image 118
Pau Avatar answered Nov 20 '22 00:11

Pau


Set\Change your current jdk path in eclipse.ini.

-vm
C:\Java\JDK\1.8\bin\javaw.exe

Sample Ini file contents:

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Java\JDK\1.8\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx1024m
like image 2
Selvaganesan Saminathan Avatar answered Nov 20 '22 02:11

Selvaganesan Saminathan


The following environment variables were removed and the Connect client was able to successfully launch:

_JAVA_OPTIONS JAVA_TOOL_OPTIONS IBM_JAVA_OPTIONS

The operating system environment variables can be found by:

From Desktop, right-click on My Computer icon-> Properties -> Advanced.
Click the Environment variables button to remove the before-mentioned system environment variables.
like image 1
anitha Avatar answered Nov 20 '22 02:11

anitha