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

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.

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...

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

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.

In the environment variables check the value of Path variable, it would have reference to the Oracle javapath which would be incorrect java version and may cause the issue. just remove "C:\ProgramData\Oracle\Java\javapath;" from the Path variable and try.

We need to delete all the content in the folder specified in the error msg.Please go through the link below for example JVM Terminated

Related

I kept getting the message like 'failed to create the Java Virtual Machine' on MacOS Mojave

Failed to save 'eclipse.ini': Unable to write file
'/Volumes/Eclipse 2/Eclipse.app/Contents/Eclipse/eclipse.ini' (Unknown (FileSystemError): Error: EROFS: read-only file system, open '/Volumes/Eclipse 2/Eclipse.app/Contents/Eclipse/eclipse.ini')
This what happened when I try to manipulate what in this ini file as suggested in similar problems.
Here is my error message of saving in visual studio code
-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.1200.v20200508-1552
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=#user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
I do not have permission for this file for some reason. Also my previous question someone suggests me that the problem is not installing java jdk but after I installed it, then launch java ee version, same error appears. How do I fix this?
I open the get Info of this ini file, it says dylan(writes/reads). I am confused.
Can someone tell me how to exactly install it.
Moreover, I look it up in java official guide of solving this problem, it says
If you’re seeing this popup when you launch Eclipse itself, or the Eclipse installer on your macOS, this post is for you. First, there’s a bit more details on the Eclipse and JDK bug trackers. To fix this, you will need to uninstall the problematic JDK version and install the latest one on your macOS machine:
Run the /usr/libexec/java_home -V command to list all installed JVM versions.
Identify the problematic version of the JVM – in my case it was “14, x86_64: "Java SE 14" /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home“.
Delete that version – with something like
“sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-14.jdk/“
Install the latest matching JVM / JDK – at the time of this writing it is 14.0.1
Verify that it appears in the list of installed JVMs with
/usr/libexec/java_home -V
If needed, point the Eclipse.app/Contents/Eclipse/eclipse.ini to the location of the newly installed JVM (-vm parameter)
I am not sure how it works. For example, how do I identify which one is problematic, and what command should I use in terminal to install it, etc.
I have the same problem and I updated eclipse.ini file as following:
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin
I added these lines to update -vm parameters right before -vmargs parameters and it works fine for me. Got from this website -> https://www.journaldev.com/10882/eclipse-ini-vm-arguments-file-location-mac-windows

STS : Failure to create Java Virtual Machine

I am unable to start my STS (Spring Tool Suite) on my new macOS - High Sierra Version - 10.13.6
The following are the contents of my STS.ini file
-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.551.v20171108-1834
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.8
--add-modules=ALL-SYSTEM
-Xms384m
-Dosgi.module.lock.timeout=10
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Xdock:icon=../Resources/sts.icns
-Xmx1200m
-XX:+UseCompressedOops
Java version - openjdk version "1.8.0_144"
STS version - 3.9.6
Mac Version - 10.13.6
Tried adding -vm option with value /Library/Java/JavaVirtualMachines/1.8.144_1_openJDK_macosx.jdk/Contents/Home and changing Xmx/Xms to different values in my STS.ini but nothing worked.
Any suggestions?
Faced a similar issue when I upgraded Java from Java 8 to openjdk 14. I resolved it by doing the following:
Open /Applications/SpringToolSuite4.app/Contents/Eclipse/SpringToolSuite4.ini
Add the following lines to the start of the file and save it:
-vm
/Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/Home/bin/java
Now, you need to point the softlink of libjli.dylib inside /Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/MacOS/ to the right location. To do that, do the following:
cd /Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/MacOS/
sudo rm libjli.dylib
sudo ln -s /Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/Home/lib/libjli.dylib libjli.dylib
Now, try opening SpringToolSuite4 and it should work seamlessly. If you are using another version of jdk, make sure that the path is chosen correctly in the ini file as well as the softlink creation part. Note: You do not need to play around with vmargs to adjust the -Xms and -Xmx args to resolve this.
open file /Applications/SpringToolSuite4.app/Contents/Eclipse/SpringToolSuite4.ini
add
--launcher.appendVmargs
-vm
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java

Eclipse neon "Could not create the JVM"

We are setting up eclipse neon on Java 1.7 and it fails to start showing a popup with message
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Here is configuration in eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.401.v20161122-1740
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.7
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.7
-Xms256m
-Xmx512m
I found this answer helpful. I was getting this error even after using java 8, So just delete eclipse.ini file, but backup first.
As of Eclipse Platform 4.6, and the Neon release, a Java 8 (or later) JRE or JDK is required to run Eclipse.
There is chance that the current eclipse you have was not completely downloaded. Try downloading again and try the set up again.
I received this error after upgrading from neon.2 to neon.3. Since Eclipse is ever-changing, what worked last year may not work today. My experience has shown the VM args to usually be the culprit in this situation, so my solution was to remove the -vmargs section of my eclipse.ini file and then restart Eclipse.
In my case it started correctly, so I added the VM args back one at a time until it failed. The source of my startup problems this time was -XX:+UseParallelGC. After some research I swapped it out for -XX:+UseG1GC and now I'm back in business.
Download and install JRE version 8, as it's required by Eclipse.
i just deleted the eclipse.ini then it worked like a charm
just add your jdk path on the top of your init file as below.
-vm
C:/Program Files/Java/jdk1.8.0_71/bin/javaw

Eclipse won't start after uninstalling EGit plugin

I just uninstalled all of EGit plugins that I had before. The uninstall went through smoothly and asked me to restart Eclipse at the end but then Eclipse wouldn't start giving me the following error message:
I get that when I try to launch Eclipse from my shortcut on the Start Menu (using Win 7). But when I go to the Eclipse install directory itself and hit eclipse.exe there, I get the following error message:
I did go to see whether there is jvm.dll in the above directory and indeed it is there.
Any idea how to fix it?
UPDATE 1: I reinstalled both Eclipse AND JRE but the problem remains.
UPDATE 2: Here are the contents of my eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
JRE & Eclipse should both be the same bit version (32 or 64). Your screenshot suggests you're running the 32-bit version of JRE, but I don't know if that was before or after you re-installed. java -version should help with JRE. Your eclipse.ini file will tell you the Eclipse bit version you're running. For example:
plugins/org.eclipse.enter code hereequinox.launcher.win32.win32.x86_1.0.
You should confirm this and try manually pointing Eclipse to your JRE binary. Here's a Windows example
-vm c:\java\jdk\1.6\bin\javaw.exe
If that works, you just need to update your eclipse.ini with the correct path.
Good luck.
Turned out the Java I had (and the only version I had access to due to the corporate network restrictions) was 1.6 32-bit even though my laptop is 64-bit (why does this work?). When I tried to reinstall Eclipse, I was using the 64-bit version. It worked when I installed the 32-bit version. BTW, the Eclipse version is
Eclipse IDE for Java EE Developers 1.4.1.20110909-1818 epp.package.jee null

Problem Installing Eclipse on Ubuntu

I downloaded the Eclipse IDE for Java Developers Linux 32 Bit file from here.
I extracted the file and launched eclipse from the command line.
Instead of Eclipse starting I get this message in a dialog box:
VM terminated. Exit code=13
/usr/bin/java
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx384m
-jar /home/justme/Desktop/FIREFOX_DOWNLOADS/eclipse/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
-os linux
-ws gtk
-arch x86
-showsplash
-launcher /home/justme/Desktop/FIREFOX_DOWNLOADS/eclipse/eclipse
-name Eclipse
--launcher.library /home/justme/Desktop/FIREFOX_DOWNLOADS/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.1.R36x_v20100810/eclipse_1309.so
-startup /home/justme/Desktop/FIREFOX_DOWNLOADS/eclipse/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
-exitdata 420021
-product org.eclipse.epp.package.java.product
-vm /usr/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx384m
-jar /home/justme/Desktop/FIREFOX_DOWNLOADS/eclipse/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
Any ideas how to fix this? I'm on Ubuntu 8.10 64bit and here's my Java info:
$ java -version
java version "1.6.0_0"
IcedTea6 1.3.1 (6b12-0ubuntu6.7) Runtime Environment (build 1.6.0_0-b12)
OpenJDK 64-Bit Server VM (build 1.6.0_0-b12, mixed mode)
First thing is to ensure you're running the java you think you're running. You can tell from your error output that it's using /usr/bin/java so run
/usr/bin/java -version
to check the version. That java is not necessarily the one on your path - you can find out which one that is with:
which java
Second thing you should probably try is the 64bit version of Eclipse. Everything else you have is 64bit.
Beyond that, I had all sorts of trouble early on with non-Sun JREs. That may not be the case now (or it may have been only specific to me) but it's something else you may want to look at.
On top of that (and probably unrelated to the problem at hand), do you really want to be running Eclipse from within your Firefox download directory. I would move it somewhere else personally.