How to run Eclipse with different Java version? - eclipse

I am using Eclipse for developing BlackBerry Applications. I have JDK/JRE 7 currently on my computer, but that makes the BlackBerry plugins crash. Actually is a known issue and the only thing need to be done is run Eclipse with JDK/JRE 6 instead of 7.
I downloaded and installed version 6. However I am pretty sure Eclipse still uses 7. I had the same problem a year ago and I remembered I had to configure some System Variables and it worked, but I can't really find the solution now.
Any idea on this one? Important! I don't want to compile in version 6, which means I just have to choose the Java version through Eclipse. What I need is Eclipse to start with version 6.

Open eclipse config file eclipse.ini in your Eclipse folder.
Add -vm yourPath\Java\jre6\bin\javaw.exe like:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-vm
C:\Java\jre6\bin\javaw.exe
...
If the path contains spaces there is no need to escape them, see the Eclipse Wiki for more specs. The -vm option and the path must be on separate lines. The -vm option must come before the -vmargs option. On Linux, the path would typically be /bin/java instead of the Windows path shown above. You must use the Java and Eclipse versions must match (i.e. 32-bit Eclipse runs on 32-bit Java and 64-bit Eclipse runs on 64-bit Java).

Note that option -vm C:\Java\jre6\bin\javaw.exe should be right before -vmargs. Otherwise you'll get 'Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit'

Do this:
1. Go to the folder where eclipse is installed (the one that has the eclipse.exe program in)
2. Open the text file eclipse.ini with notepad or something similar
3. Add the following lines to specify the JVM location using the -vm argument
-vm
c:/jre/bin/javaw.exe
Now start eclipse in the usual way.
Make sure to position the -vm argument before -vmargs, since the latter is passed to the VM on startup it will be too late to set the VM after this.
More info is available on the Eclipse wiki
You could also have changed the system path as per one of the other answers but this would change the JVM being used for the whole system. If you use the eclipse.ini settings it allows everything else to use the latest JVM.

Many hints given already. Anyway I will just provide the recommended way of doing it which might help for future reviews of that question:
Use the eclispe.ini file (folder where the eclipse binary resides)
Add the -vm option with the path of the jre to startup with
i.e Windows
-vm
C:\Java\jdk1.6.0_45\jre\bin\javaw.exe
i.e Linux
-vm
/opt/sun-jdk-1.6.0.02/bin/java
The -vm option must occur after the other Eclipse-specific options (such as -product, --launcher.*, etc), but before the -vmargs option, since everything after -vmargs is passed directly to the JVM.
The -vm option and its value (the path) must be on separate lines.
The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.
see: the eclipse.ini authoring guidelines from eclipse wiki

Since none of the answers worked for me this is my solution:
I downloaded java 6 and i installed it. Then in the program files , inside the folder of java , i copied the folder jre6. I pasted it inside the eclipse folder and renamed it jre.
Thats it! When inside the eclipse installation folder your have a folder named jre , then the java in there is the java that eclipse will run with.
Thank you all for your answers!

These two options worked for me on Windows:
Edit eclipse.ini
-vm
C:/Java/jdk1.7.0_71/jre/bin
-vmargs
...
Copy jre folder to eclipse folder.
So after the copy I have C:\eclipse\jre folder which is a copy of C:\Java\jdk1.7.0_71\jre

If you want to make sure you are running you java apps in Windows 7 with an specific java version:
1 - Check out what which version is running by default. Run cmd to go to the console and type: java -version
C:>java -version
java version "1.6.0_45" Java(TM) SE Runtime Environment (build
1.6.0_45-b06) Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)
2 - Change the default jdk by changing the path. Example here. Make sure you java.exe from your desired jdk is before any other java.exe from any other JDK in the path.
ex. in JDK 1.6 you java.exe should be here C:\java\jdk1.6\bin\java.exe.
Once you have changed the path, open a new console and verify again which jdk version you are running.
3 - Make sure in eclipse.ini param -vm another jre version is not set.

I modified eclipse.ini file as follows (added my local JDK path) and it fixed eclipse loading issue.
-vm
C:\Program Files\Java\jdk1.8.0_251\bin

I too faced same issue while running eclipse with different version then default on the system.
I created a symlink of required jre directory under eclipse directory and then it was all working.
For windows user: symlink is similar to creating shortcut
Hope it helps you too.

Related

Eclipse neon, stopped with exit code=-1073740791

I'm trying to reinstall eclipse and add:
-vm C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe.
See Image.
Please try the rules for specifying the virtual machine for eclipse as found here:
Note the format of the -vm option - it is important to be exact:
The -vm option and its value (the path) must be on separate lines.
The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.
The -vm option must occur after the other Eclipse-specific options (such as -product, --launcher.*, etc), but before the -vmargs option, since everything after -vmargs is passed directly to the JVM.
Experiencing the same problem here, running Eclipse Neon.2 and JRE 1.8.0_121 on MS Windows 10.
If I specify a JVM in eclipse.ini (putting the -vm option and the javaw.exe pathname on separate lines in the right position, as Carlos Heuberger correctly suggests), eclipse crashes at startup with exit code=-1073740791, before opening the interface, but after initializing the workspace.
If I run Eclipse again, the interface opens and I can start working, but it is likely to crash after a while, apparently in a random way.
If I remove the -vm option from eclipse.ini and set JAVA_HOME and PATH in the environment, Eclipse seems to work fine; of course, this might cause problems to other applications on your system.
I think I eventually found the solution to the problem: the eclipse.ini file coming with the distribution has the JVM option -Dosgi.requiredJavaVersion=1.8 duplicated: simply remove the second instance and it will work like a charm!

No Java virtual machine was found (Eclipse)

When trying to run Eclipse Kepler (for the first time), I get the following error:
I am aware that this issue has been solved many times before. However, I have changed eclipse.ini to say -vm C:\Program Files (x86)\Java\jdk1.6.0_21\bin\javaw.exe but to no avail. The same error always comes up.
===UPDATE===
I added a line break after -vm and now I get this dialog box:
and the eclipse.ini file:
-vm
C:\Program Files (x86)\Java\jdk1.7.0_51\jre\bin\javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.java.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
The problem is that you are trying to start a 64 bit version of Eclipse with a 32 bit version of Java. The bitness should match. You can download 64 bit Java here
Start Eclipse with a 64 bit JVM and the problem will go away.
To do so:
eclipse.exe -vm c:\path\to\64\bit\bin\javaw.exe
You can also update the the first two lines in your eclipse.ini file to use the 64 bit java by default by doing the following:
-vm
c:\path\to\64\bit\bin\javaw.exe
(NOTE: be sure the argument and value each exist on a separate line)
Also, you can also download a 32 bit version of Eclipse for use with 32 bit Java. The key is that the bitness is the same.
You are pointing your 64-bit Eclipse at a 32-bit Java installation. They need to match. You can either get and use the equivalent 32-bit Eclipse download or make sure you install a 64-bit Java.
You were correct to place -vm and the path on separate lines in eclipse.ini. The error shown in your updated screen shot indicates that you're running 64-bit Eclipse on a 32-bit JDK, which doesn't work. The bit-ness of them have to match.
No need to open eclipse.ini, just follow the path its requesting to launch it ie....most jre folders have an added extension to the name eg. jre1.8.0_45, just cut that folder from java folder and paste in eclipse folder and delete the extension. It becomes just jre now launch eclipse it should work.
Can you try one of these?
(1) just copy the jre to the directory it asked.
(2) add the jvm path to system path, which is located under control panel -> system -> advanced -> environment variables.
Forgot this is Windows... quotes. I think you need to put it in quotes because there are spaces in the string. -vm "C:\Program Files (x86)\Java\jdk1.6.0_21\bin\javaw.exe"
instead of using "Program Files(x86)" in the path try using something like
C:\Progra~2\Java\jre7\bin\javaw.exe - for 32 Bit
C:\Progra~1\Java\jre7\bin\javaw.exe - for 64 bit
It worked for me
For people who have tried the above solutions, as I have, and despite ensuring the same bitness and giving the direct path etc. still failing to get it to work - here's what did it for me.
-vm
java\bin
I pointed to the bin folder and Eclipse found the file it wanted (whatever it was) automatically, so try that out.
Note: I put my jre in my Eclipse folder so the path is that short for me... basically, just try pointing to the bin folder instead of a specific file.
Run java.exe from C:Prgram Files...\bin. A cmd promt will be running. Just minimize it and then try running eclipse.exe. Worked for me
I am facing the same problem. I found that due to installation of JDK, I removed the path "C:\ProgramData\Oracle\Java\javapath" in the PATH environment variable that caused the problem. SO I added this path again and it works fine.
Two ways to work around this .
Recommended way : In your eclipse.ini file make sure you are pointing -vm to your jdk installation. More on this here .
Pass in the vm flag from command line. http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F#Find_the_JVM
Note : Eclipse DOES NOT consult the JAVA_HOME environment variable.
I fixed by changing the version of jre version in the file: Eclipse.ini (Path: C:\Users\"your_system_name"\eclipse\java-oxygen\eclipse)
In the Eclipse.ini file you should be able to see the line (-vm
C:/Program Files/Java/jre1.8.0_111/bin) change the path to new version (-vm
C:/Program Files/Java/jre1.8.0_161/bin).
Save & Launch the Eclipse.
It worked for me!
Got same issue to day. Java updated to jre1.8.0_171 earlier this morning. There is not a VM line in the eclipse.ini file at all so the typical answer did not work. Was running from shortcut created several weeks ago. Deleted shortcut for Eclipse (Oxygen) and created new shortcut that pointed directly to the the executable and problem went away. Cannot explain why this solution worked but it did.
open - >
C:\Users\userName\eclipse\jee-2020-03\eclipse - eclipse.ini
find javaw.exe -> C:\Program Files\Java\jre1.8.0_261\bin
if Javaw.exe is present (2) in the given Path then copy the path like
C:\Program Files\Java\jre1.8.0_261\bin\javaw.exe
paste inside eclipse.ini after just after -vm
example:
-vm C:\Program Files\Java\jre1.8.0_261\bin\javaw.exe
then open eclips.exe
For this error, I struggled a lot and found this solution which will work definitely and it's very easy way.
this is the error I got. If you notice, there is path which it is unable to find, which is JDK/jre folder. So just copy "jre" folder in JDK and paste it inside "eclipse" folder, as below:
Try Restarting eclipse, it will start. Thanks!!!

How to change default JRE for all Eclipse workspaces?

I have one JRE in C:\Program Files (x86)\Java\jre6 and that was the only one at the time I installed Eclipse. I have subsequently installed a complete JDK in C:\home\SFTWR\jdk1.6.0_21 and changed my JAVA_HOME environment variable to that. However, every time I start a new Eclipse workspace, it only picks up the old JRE and I have to manually remove it and add the new one.
How do I bind my Eclipse install to the new JDK so that every new workspace points to that only? I checked eclipse.ini but there was no reference there to which JRE to go to.
UPDATE:
I went into Prefs->Java->Installed JREs, added the new location, marked it as default, removed the other, and it was effective only for the current workspace. However, when I opened a new workspace, only the old JRE was available. So this didn't change the core Eclipse config that is applicable across all (at least new) workspaces
Finally got it: The way Eclipse picks up the JRE is using the system's PATH.
I did not have C:\home\SFTWR\jdk1.6.0_21\bin in the path at all before and I did have C:\Program Files (x86)\Java\jre6\bin. I had both JRE_HOME and JAVA_HOME set to C:\home\SFTWR\jdk1.6.0_21 but neither of those two mattered. I guess Eclipse did (something to the effect of) where java (or which on UNIX/Linux) to see where Java is in the path and took the JRE to which that java.exe belonged. In my case, despite all the configuration tweaks I had done (including eclipse.ini -vm option as suggested above), it remained stuck to what was in the path.
I removed the old JRE bin from the path, put the new one in, and it works for all workspaces.
The Installed JREs is used for what JREs to execute for your downstream Java projects and servers. As far as what JVM or JRE that is used to execute Eclipse process (workbench) itself that is controlled by your environment, history and eclipse.exe binary. So eclipse.exe itself decides what JRE Eclipse will execute itself with, not installed JREs preferences since those are not read until OSGi framework is up and running which is loaded after the JVM/JRE is picked.
So for new workspaces, Eclipse is going to use its currently executing JRE to populate the JRE prefs.
The best way I know how is to force eclipse.exe to use the JRE that you tell it via the -vm switch. So in your eclipse.ini do this:
-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
-vm
/path/to/exactly/what/jre/you/want/as/default/javaw.exe
...
Open the Java > Installed JREs preference page. Check the box on the
line for the JRE that you want to assign as the default JRE in your
workbench. If the JRE you want to assign as the default does not
appear in the list, you must add it. Click OK.
Source-http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-assign_default_jre.htm
In eclipse go to
Window-> Java -> Installed JREs
You can remove your current installed jre and add the jdk by specifying the path to where the jdk is installed.
I ran into a similar issue where eclipse was not using my current %JAVA_HOME% that was on the path and was instead using an older version. The documentation points out that if no -vm is specified in the ini file, eclipse will search for a shared library jvm.dll This appears in the registry under the key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment that gets installed when using the windows java installer (key might be a bit different based on 64-bit vs 32-bit, but search for jvm.dll). Because it was finding this shared library on my path before the %JAVA_HOME%/bin, it was using the old version.
Like others have stated, the easiest way to deal with this is to specify the specific vm you want to use in the eclipse.ini file. I'm writing this because I couldn't figure out how it was still using the old version when it wasn't specified anywhere on the path or eclipse.ini file.
See link to doc below:
http://help.eclipse.org/kepler/topic/org.eclipse.platform.doc.isv/reference/misc/launcher.html?cp=2_1_3_1
Finding a VM and using the JNI Invocation API
The Eclipse launcher is capable of loading the Java VM in the eclipse process using the Java Native Interface Invocation API. The launcher is still capable of starting the Java VM in a separate process the same as previous version of Eclipse did. Which method is used depends on how the VM was found.
No -vm specified
When no -vm is specified, the launcher looks for a virtual machine first in a jre directory in the root of eclipse and then on the search path. If java is found in either location, then the launcher looks for a jvm shared library (jvm.dll on Windows, libjvm.so on *nix platforms) relative to that java executable.
If a jvm shared library is found the launcher loads it and uses the JNI invocation API to start the vm.
If no jvm shared library is found, the launcher executes the java launcher to start the vm in a new process.
-vm specified on the command line or in eclipse.ini
Eclipse can be started with "-vm " to indicate a virtual machine to use. There are several possibilities for the value of :
directory: is a directory. We look in that directory for:
(1) a java launcher or
(2) the jvm shared library.
If we find the jvm shared library, we use JNI invocation. If we find a launcher, we attempt to find a jvm library in known locations relative to the launcher. If we find one, we use JNI invocation. If no jvm library is found, we exec java in a new process.
java.exe/javaw.exe: is a path to a java launcher. We exec that java launcher to start the vm in a new process.
jvm dll or so: is a path to a jvm shared library. We attempt to load that library and use the JNI Invocation API to start the vm in the current process.
My answer will overlap with amphibient's while adding on to it.
Your JAVA_HOME variable is fine, but you also need to append the following to your Path variable :
;%JAVA_HOME%\bin
This will allow your applications in your Windows environment to access your JDK. You should also restart your computer once you've added these environment variables before checking out if they work. In my case, even logging out and then back in didn't work : I had to completely restart.
If you want to check if the environment variables are set correctly, you can open up a command prompt and type >echo %JAVA_HOME and >echo %Path% to see if those variables are working correctly. While snooping around for solutions, I have also run into people claiming that they need to add quotations marks (") around the environment variables to make them work correctly ("%JAVA_HOME%"\bin) if your JAVA_HOME path includes spaces. I thought that this was my case at first, but after doing a full restart my variables seemed to work correctly without quotation marks despite the spaces.
when you select run configuration, there is a JRE tap up next the main tap, select "Workspace default JRE(JDK1.7)".
Be sure to use the jdk in Prefs->Java->Installed JREs ->Execution Environment
I have faced with the same issue. The resolve:
- Window-->Preferences-->Java-->Installed JREs-->Add...
- Right click on your project-->Build Path-->Configure Build Path-->Add library-->JRE system library-->next-->WorkSpace Default JRE
try to change the order:
right click on you project-> BuildPath->Configure...->Order and Export tab -> move jre7 UP.
I navigated to:
Eclipse>Pref>Java>Installed JRE>Search...
2 of them popped up and I checked the latest one. Before I did this I also went to About>Check for Updates and updated it. I didn't have to reinstall any JRE or JDK either. I might have done it a while back, except it was with 1.6 not 1.4. Hope that helps!
On windows I've tried different approaches
- setting JAVA_HOME, JRE_HOME and extending the PATH to point to the desiered jre18 but nothing helped
- disabling the JRE17 in the java control panel didn't helped either
What helped me out was to force eclipse to use the appropriate JRE in the eclipse.ini file e.g.
-vm
C:\java\jdk1.8.0_111\jre\bin\javaw.exe
#Stefan Michev answer also worked for me,
edit eclispe.ini to point to your installed JRE
-vm
C:\Program Files\Java\jdk-18.0.1.1-openj\bin
but to elaborate;
My application server uses JAVA_HOME and thus PATH so I needed Eclipse to pick up another JRE to run (so to be compatible with an installed plugin).
This Eclipse JRE is different than
than setting Window-> Preferences -> Java -> Installed JREs which as you see in the below image, is for building Java projects, so you can have different projects with different JDKs
Eclipse Installed JREs

eclipse won't start - no java virtual machine was found

Eclipse was running fine yesterday (and has been since I installed it about a year ago). Now all the sudden I'm getting the following error on startup:
"A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
C:\Program Files\eclipse\jre\bin\javaw.exe
javaw.exe in your current PATH"
I have not changed anyhing Eclipse/Java related on my machine but a Windows update was applied to my machine yesterday, so maybe that has something to do with it (but I don't see anything that would affect Java). I've looked at all the other posts about adding something to your PATH or adding the -vm option to the Eclipse ini (couldn't get this to work) or copying the jre folder to eclipse\jre (this worked but doesn't seem like a good long term solution). So I'm really trying to figure out how to get things back to the "default" setup without messing stuff up.
I'm running Windows 7, Eclipse Helios and Java 1.6.0_26.
Two ways to work around this .
Recommended way : In your eclipse.ini file make sure you are
pointing -vm to your jdk installation. More on this here. Make sure to add -vm before the -vmargs section.
Pass in the vm flag from command line. http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F#Find_the_JVM
Note : Eclipse DOES NOT consult the JAVA_HOME environment variable.
Make sure both the Java version and Eclipse are belongs to same architecture.So install 64 bit java for 64 bit eclipse.
eclipse.ini:
--launcher.defaultAction
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize<br/>
256m
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
-vm
C:\Program Files\Java\jdk1.7.0_21\jre\bin\server\jvm.dll<br/>
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.7
That worked for me. It doesnt have to be on the beginning, but surely it cant be at the end of the file.
In my case i had few things missing. I didnt install JDK and JRE of 64 bit while eclipse was of 64 bit version. Once done and JDK\bin path was set in PATH variable eclipse worked fine :)
Open eclipse.ini file besides eclipse.exe
paste
-vm
C:\Program Files\Java\jdk1.7.0_21\jre\bin\server\jvm.dll
//find it if you are having another JDK version.
on first line. And you are good to go.
I had same problem after updating java.
Then I paste
-vm
C:\Program Files\Java\jre6\bin\javaw.exe
to show the path of javaw.exe in eclipse.ini file.
Hope this will help you.
After setting Java Path, if you are not able to open your eclipse do below steps:
Go to your Eclipse Folder where you have extracted your eclipse.
Open Eclipse file in notepad (by default it will open on notepad)
Enter two lines
-vm
C:/Program Files/Java/jdk-11.0.2/bin/javaw.exe
jdk-11.0.2 ,It should be your Java Version, which you will get by the above location.
I had the same problem. I my case it was a program i've install that had destroyed the PATH env variable.
so check your PATH environment variable.
First
check if you have both java 32 and 64 bit install then
Setting Path on Windows
Windows 8
Drag the Mouse pointer to the Right bottom corner of the screen
Click on the Search icon and type: Control Panel
Click on -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH, Or simply make sure that the variable name is in ALL CAPS
If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Close the window.
Reopen Command prompt window, and run your java code.
Via Puppet ATG installation Centos.
ERROR:
No Java virtual machine could be found from your PATH
SOLUTION:
Declear variable :
$java_home="/opt/oracle/product/java/jdk1.8.0_45/bin"
Add This "{$java_home}" Java Exec
require common, java
Exec {
path => [ "${java_home}", "/usr/bin", "/bin", "/usr/sbin", "${temp_directory}"]
}
On Centos 7 I fixed this problem (after a big yum upgrade) by changing my setting for vm in:
~/eclipse/java-oxygen/eclipse/eclipse.ini
to:
-vm
/etc/alternatives/jre/bin
(which will always point to the latest installed java)
If Eclipse isn't finding your JRE/JDK or finding the wrong version, add the following two lines to the beginning of your eclipse.ini file:
-vm
[your-path-to-java-executable]
Try downloading and installing 32-bit version of Java, and then setting the path :)
Yeah it happend to me right now. Go to Oracle site, and search for Java SDK. Make sure you use the same architeture (x86, x64) of Eclipse.
This happened to me also. And I found the javaw.exe in C:\Windows\System32 got deleted after the windows update. Copied one more time and Eclipse started all fine.
Chek os,eclipse,and java whether it is 32 or 64 bit
you can also copy your JRE folder to eclipse directory and it will work corectly
The problem occurred on my machine due to Java version got updated(66 from 60). Pay special attention to it. As said above would like to add
In this file eclipse.ini, which is available where you have installed eclipse search for the line below -vm example
C:\Program Files\Java\jre1.8.0_66\bin
now try to open this location, in case you are not able to open, that means there is some problem. In my case the version installed was jre1.8.0_60 . So there was a small difference which may not noticeable(66 instead of 60). Update it you will be able to open.
I came across same issue y'day, with PATH etc configured correctly.
It can be opened from command line, just now working by a double click.
And it was working now, by just "Run as administrator" :)
Some time this happens when your Java folder get updated.
Open Eclipse folder and search file eclipse.ini.
Open the eclipse.ini file and check whether jre version is same as jre available in your java folder.
I faced same problem when my jre got changed from jre1.8.0_101 to jre1.8.0_111.
C:\Program Files\Java\jre1.8.0_101\bin
to
C:\Program Files\Java\jre1.8.0_111\bin
In my case the problem was that the path was enclosed in quotation marks ("):
-vm
"C:\Program Files\Java\jdk1.8.0_25\bin"
Removing them fixed the problem:
-vm
C:\Program Files\Java\jdk1.8.0_25\bin
My solution is Include JDK's "bin" Directory in the PATH
To edit the PATH environment variable in Windows 7/8/10:
Launch "Control Panel" ⇒ (Optional) System and Security ⇒ System ⇒ Click "Advanced system settings" on the left pane.
Switch to "Advanced" tab ⇒ Push "Environment Variables" button.
Under "System Variables" (the bottom pane), scroll down to select "Path" ⇒ Click "Edit...".
Copy the JDK bin directory from JAVA folder and paste to "Edit..."
you should change the jdk path in eclipse.ini here:
/Users/you_username/eclipse/jee-photon/Eclipse.app/Contents/Eclipse/eclipse.ini
after you should restart eclipse :)

JVM terminated. Exit code = -1

I've been using Eclipse for some time already, and I didn't have any problems with it. However, when I tried to generate some javadoc, I found that I didn't have the SDK installed. I installed jdk 6u23, and from then on, Eclipse hasn't been working.
At first it told me it couldn't find a JRE/SDK. After copying and placing the JRE in the Eclipse folder, the error changed to this:
I've searched around for some solutions, and found a few of varying nature. However, none of them seemed to work.
I've tried emptying my eclipse.ini file without success.
Altering some values in eclipse.ini didn't work either.
Installing Java SDK 1.5 didn't work.
Does anyone have other possible solutions?
Update: I tried reinstalling Eclipse, but it didn't fix the problem. I did notice that it's a 32bit version, while I'm running a 64bit system. However, if this were to be the problem, I find it strange that it hasn't been an issue earlier.
Update 2 I've reinstalled both Eclipse and Java once more, and everything works again.
Remove the default value "256m/256M" from the eclipse configuration file (eclipse.ini).
You will find this line just below "--launcher.XXMaxPermSize".
Edit your Environment Variables >> System Variables >> Path to
C:\Program Files (x86)\Java\jdk1.6.0_24\bin;
(NOT C:\Program Files\Java\jdk1.7.0_01\bin;)
it should work
If you have got a problem like that, you should change the path of jre.
Firstly, computer> properties > advance system setting > Environment variables > find "path" under system variables then give the directory of your jre/bin. (for example C:\ Program Files\ java\ jre\ bin)
Perhaps you should reinstall Eclipse. Then you can add the JDK through Windows -> Preferences -> Java -> Installed JREs.
I had similar issue:
Eclipse IDE fail to launch with JVM Terminated. Exit code=-1
One thing that worked for me is to set -Xmx to 256m in eclipse.ini. If that is not good enough for you, you may also try using different JVM module than the one that eclipse uses by default.
If you look in the error dialog in your screen capture, you'll notice that the "-vm" option using "jvm.dll" as JVM. If you change it to use javaw.exe in your JAVA_HOME\bin folder, the problem should go away.
I'm still clueless as to what the difference is between using jvm.dll vs javaw.exe. Maybe jvm.dll is suppose to be used only for light-weight embedded java applet and it can't handle the load brought on by a full stand-alone Java UI software.
I just had the same problem on Windows 7, 64 bit. I reinstalled Java 32 and Java 64, and Eclipse, but it did not fix the problem. I found that in eclipse.ini the Dosgi.requiredJavaVersion was 1.5, so I changed it to Dosgi.requiredJavaVersion=1.6.0_25. In the Environmental variables I added to the PATH %JAVA_HOME%\bin;C:\Program Files (x86)\Java\jdk1.6.0_25\bin.
These changes fixed my Eclipse problem.
In my case the cause was a corrupted eclipse.ini file. I had been editing the file, and accidentally changed -Xmx512m to -Xmx512
First Approach:
I added below lines in eclipse.ini
-vm C:\Program Files(x86)\Java\jre\bin\java.exe
Modified below line in eclipse.ini (changed to 1.6.0_37 from 1.5),
-Dosgi.requiredJavaVersion=1.6.0_37
Deleted JAVA_HOME from environment variables which was pointing to c:\jdk1.6
Now Eclipse is working fine.
Second Approach:
Another way - don't add below line in Eclipse and only modify JAVA_HOME to point to C:\Program Files(x86)\Java\jre,
-vm C:\Program Files(x86)\Java\jre\bin\java.exe
Eclipse should work now.
I added the entry in the Path environment variable to the jdk bin folder and it started working
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft Application Virtualization Client;C:\Program Files\Java\jdk1.6.0_18\bin
There could be many possible causes for this error. It could be that compatible mode is not selected in windows 7 , path or eclipse.ini problem.
Please add "-vm" option to the eclipse.ini file available in the same folder as eclipse.exe.
The -vm option should point to the javaw.exe located in your machine, something like the below.
-vm C:\Program Files(x86)\Java\jre\bin\jawa.exe
After adding the above line to eclipse.ini save it. Now clicking eclipse.exe will automatically launch the IDE.
I had the same problem and it turned out to be a problem with 64-bit versions. My solution was removing all my Java programs and reinstalling the 64-bit JRE (I had downloaded the 64-bit Eclipse).
I tried all the solution still didnt find my luck.Lastly i got it resolved by pointing to client jvm.dll in eclipse.ini file
-vm
C:\jdk160_05\jre\bin\client\jvm.dll
I made a series of trials which you may find useful if you face the same and not getting resolved yet
exit-code-1
I resolved it by installing 32 bit JDK and editing eclipse.ini to point to 32 bit jdk . Added -vm C:\Program Files (x86)\Java\jdk1.7.0_71\bin at the end of eclipse.ini file.
Note: I have my JAVA_HOME pointint to 64 bit JDK
There is no need for reinstalling eclipse IDE or changing your environment variables. I had encountered this problem while working on my project I had this issue but I fixed it in no time and it works fine for me.
Before implementing any solution, Check first that you don't have multiple installations of JDK in your system. I have encountered many systems with JDK 1.7 and JDK 1.8. If it is so, simply change your -vm to the alternate jdk
C:\Program Files\Java\jdk1.7.0_60(jdk version you were not using)\jre\bin\client\jvm.dll
and start your eclipse IDE. IT will work but the workspace will not synchronized and the files will not be getting displayed. Just close your IDE and revert to your previous jdk link and Voila It works.
In case you have a single JDK installed in your system. I suggest clearing your CPU Physical memory. It so happens JVM has issues in execution if a lot of memory is utilised. Just go to the Task manager and close any redundant processes.
Hope this helps! Keep Coding :)
I added the new JRE to the eclipse.ini file and updated my PATH. Seemed to work for me.
I had encountered the same type of the popup message when i am opening IDT app in SAP. It has been resolved after reduced below value
Option Name: _JAVA_OPTIONS
value: -Xms512M -Xmx1024M ( Previously -Xmx2048)
If you encounter a problem like this you can get a little more information by using eclipsec.exe from a command-line instead of eclipse.exe. I got this additional info in the dos box:
C:\<...>\Eclipse>eclipsec
Error occurred during initialization of VM
Could not reserve enough space for object heap
So I lowered my -Xmx setting in eclipse.ini from 1024 to 768, which made it work again.
Why this was suddenly necessary I do not know atm, Eclipse has been running fine with 1024m some days ago.
I am able to solve same issue by specify the -vm
C:\Program Files\Java\jdk1.6.0_45\bin\javaw.exe in eclipse.ini.
I have the same error. It might be because your PC was forced to shut down at night.
My solution was go to the path C:\Users\<find your user profile>\AppData\Local\javasharedresources and delete the file inside this folder
You just click on startup on eclipse folder and open the eclipce or right click on startup and click open with last javaw, then you can find solution.
This problem occure in the case, when you are using 64 bit OS on 32 bit motherboard.
Now, it can be resolved easly,
First uninstall 64 bit java and install 32 bit java.
and set environment variable with jdk path.