I have multiple versions of Java installed on Windows 7 Home Premium 64-bit system. In order to install
Eclipse Java 2018-12
I have had to install the Java 11 JDK from the Oracle website. Despite setting JAVA_HOME and updating PATH in environment variables the only way to install and also run this version of Eclipse was to open a command prompt and
C:>set path=c:\program files\java\jdk11.0.1\bin
and then run Eclipse installer or installed instance.
The problem persists if I reboot my computer.
I want to be able to start eclipse by simply clicking on the desktop icon link.
The error I get when I try to run eclipse from the desktop link is:
Version 1.7.0_79 of the JVM is not suitable for this product. Version 1.8 out greater is required.
My C:\Program Files\Java\
contains folders
jdk1.0.7_79
jdk-11.0.1
jre7
I think I need all of these because I have some programs which I think retire java 7 so I don't think uninstalling java 7 is an option and don't think java 11 would replace it, or should I just get rid of java 7, is that what's causing the problem despite environment variables set correctly?
How can I fix this problem?
Thanks.
Add c:\program files\java\jdk11.0.1\bin to your Windows Environment PATH
The system was running C:\Windows\System32\javaw.exe
I fixed it by adding the Java 11 bin directory at the beginning of the Path environment variable instead of at the end of the string, separated by a semicolon.
First set JAVA_HOME then update path in environmental, refer screenshots attached.
I'm trying to install Eclipse, but I can't get the installer to start. It fails with
"Failed to create the Java Virtual Machine"
How can I resolve this?
Note: I'm on Mac.
Edit the file /Applications/Eclipse.app/Contents/Info.plist
There is a comment for use a particular JVM:
<key>Eclipse</key>
<array>
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
or add a VM found via $/usr/libexec/java_home -V -->
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk8u192-b12/Contents/Home/jre/</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
It took me some time to figure this out as well. The main takeaway was eclipse does not support SDK Version 14 (as of eclipse 2020-03). That was not completely obvious to me.
Install a supported version (I used Homebrew to install SDK V8 🍺):
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
If this is the only Java Version you have installed you should be fine and Eclipse should open up. If that is not the case and you have another Java Version installed. You have to tell Eclipse which Version of Java it should be using (see Step 2).
Tell Eclipse which Version to use by editing the /Applications/Eclipse.app/Contents/Info.plist file as described by Juan Ignacio Barisich and Brad Parks. That being the version you installed in step 1.
nano /Applications/Eclipse.app/Contents/Info.plist
# or
open /Applications/Eclipse.app/Contents/Info.plist
<key>Eclipse</key>
<array>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
<string>-vm</string>
<string>/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/</string>
</array>
Disclaimer: Please bare in mind that those were the steps I took to get eclipse running again. Because I'm nowhere qualified to give a precise answer about this please take a look at the comments in case I got something wrong.
Edit: See Christian Fries answer who pointed out that all java versions 8 to 13 are supported by eclipse.
For me, I had to edit the eclipse-inst.ini file located here:
Eclipse Installer.app/Contents/Eclipse/eclipse-inst.ini
and add the path to my local java VM at the very top of the .ini file, which is here:
-vm
/Users/bparks/jdk/jdk1.8.0_162_x64/bin/java
If the Eclipse Installer.app file is in a DMG, right click on it, and copy it, then paste it into another folder. Then right click on that app file, and choose "Show Package Contents", to get into the files inside the application.
If you've already got Eclipse installed, and find it's throwing the same error, you could try a similar approach by editing the following file for Eclipse:
/Applications/Eclipse.app/Contents/Eclipse/eclipse.ini
On mac, you can get the full path you'd need to your java exe by running the following in a terminal, which will copy the path to your clipboard.
$ echo $(/usr/libexec/java_home)/bin/java | pbcopy
Note: The error "Failed to create the Java Virtual Machine" also exists with Eclipse 2020-03 (under some situations, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=561273) and it is not required to use Java 8 (with Eclipse 2020-03).
For the impatient:
You can run Eclipse or the Eclipse Installer with a given VM without changing eclipse.ini by starting it via a command line:
Open Terminal an run:
open PATHTOECLIPSEINSTALLER/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/NAMEOFJDK/Contents/Home/bin
where PATHTOECLIPSEINSTALLER is the path of the folder where Eclipse Installer is located and NAMEOFJDK is the name of the folder with the JDK (11, 12, 13).
For example:
open Downloads/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin
In the installer you may select the VM used by Eclipse. Use a compatible VM here and the installer will modify the eclipse.ini for you.
Explanation TL;DR
To clarify this issue:
Eclipse - say Eclipse 2020-03 - runs with Java 11, Java 12, Java 13, but does not run with Java 14. It fails with the message "Failed to create the Java Virtual Machine". This happens for the installer and for Eclipse itself.
You can download Eclipse without the installer from here: https://www.eclipse.org/downloads/packages/
Explanation:
On macOS, if you start a freshly installed Eclipse, it will use the default JVM. The default JVM is obtained by running /usr/libexec/java_home.
This program /usr/libexec/java_home will find the installed JDK with the highest version as default. That is, if you have JDK 14 installed and run Eclipse 2020-03, you will see this error.
Solution
Summarising some other answers here, there are three options:
Once you have removed JDK 14 from /Library/Java/JavaVirtualMachines/ the error will be gone.
If you like to have JDK 14 installed, start the installer with a different JDK via the command line open Path-to-Eclipse-Installer/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/NAMEOFJDK/Contents/Home/bin
You may edit the eclipse.ini (as suggested in other answers) to use a specific JVM.
Referring to Marseille Joseph
https://www.eclipse.org/forums/index.php?t=msg&th=1102885&goto=1823113&#msg_num_13
This worked for me!
Their solution didn't require uninstalling jdk14 or to editing the eclipse.ini file. Instead, do this:
cd /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/MacOS/
sudo rm /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/MacOS/libjli.dylib
sudo ln -s /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib/libjli.dylib libjli.dylib
I started facing the same problem in mac suddenly after updating to macOS Monterey, So I just did the following steps:
Then go to Contents/Eclipse/eclipse.ini file and open it with any text editor and you will see the following:
Add below line before -vmargs as shown in above image:
-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java
This below line will be different for all the users:
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java
and you can just get this line copied to your clipboard using this command in terminal:
$ echo $(/usr/libexec/java_home)/bin/java | pbcopy
Similarly will be for STS:
Then go to Contents/Eclipse/SpringToolSuite4.ini as shown below and open with any text editor app.
You will see the following:
Just add the same line that you added for Eclipse in the above steps:
delete all java folder inside /Library/Java
then install a new jdk from
https://adoptopenjdk.net/
which will install at
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk
then try reinstalling eclipse a
I had the same problem in my mac. Here is my solution.
First: I've uninstall all the versions of jdk, because I've try a lot of options.
To do this, you need to go to Library/Java/JavaVirtualMachines
and delete all the folders.
Second: Install jdk 1.8 here is a link to download this version:
jdk 1.8
Third: Install eclipse 2020-03 and thats all.
If you want to use JDK 14, you need to follow this steps:
Open eclipse
Go to Help > Install new software
In the Install window copy the following link in Work with https://download.eclipse.org/eclipse/updates/4.15-P-builds/
Select the third option show in the picture below
Then, click "next" and finish the install
Now you have to change the options, go to Preferences (command + ,) > Java > Compiler and search the version 14. Before this step you need to install jdk 14 (link) Perhaps eclipse would suggest you to change to the correct JREs, for this you need to go to Java > Installed JREs and add the correct version. When you click add you need to choose he JRE type, in my case I use a MacOS X VM and Standard VM, then you have to choose the directory (/Library/Java/JavaVirtualMachine/jdk-14/Contents/Home and click open you could give a JRE Name and finish eclipse will be restart and now you can use eclipse with java 14.
This works for me, I hope you have understood me.
Go to /Library/Java/JavaVirtualMachines
Delete all version except one in use.
Install jdk 8 from brew work for me. You can get the instruction on installing Jdk 8 from HomeBrew here How to install Java 8 on Mac
I met this problem with eclipse-java-2020-03-M2-macosx-cocoa-x86_64, and opendjdk11. The latest eclipse installer at the moment also complained same error.
After I switched back to openjdk8, everything goes well...
For Windows OS:
open eclipse.ini in the Eclipse program folder
add the below lines at the top of the file
-vm
path-to-java-bin\javaw.exe (for example: C:\Program Files\Java\jdk-11.0.10\bin\javaw.exe)
I mounted eclipse dmg file and copied eclipse inside Applications. Then I tried to modify file Info.plist located inside Contents as below, but was getting that this file Info.plist is readonly error. I noticed that I already have read and write permission but still it was giving me that read only error. Then I moved the contents of Eclipse to some other local folder and then edited Info.plist, it did not give me readonly error.
<array>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
Finally I am able to open eclipse.
I am trying to run Eclipse Mars on Mac. Java 8 is installed. (JDK and JRE)
Running web project on HTTP Preview gives error that Could not find JRE executable.
In Eclipse>Prefrences>Java>Installed JREs when I try to search the JRE in /System/Library/Frameworks/JavaVM.framework/Version , I am not able to find any versions inside.
Any solution?
Given, that you installed Oracle Java (JDK) 8, open a Terminal and:
sudo rm /Library/Java/Home
which removes old links first. Note: This step might be optional.
Second step (Note: replace XX first!):
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_XX.jdk/Contents/Home /Library/Java/Home
This command recreates a symbolic link to the actual Java 8 installation folder.
Afterwards, a fresh installation of Eclipse should detect Java8 in your system and should work with this version out of the box. You can modify an installed Eclipse to use this installation by navigating in Eclipse to:
Preferences -> Java -> Installed JREs.
Finally, remove the old JRE/JDK entries AND add a new one for the path (see above) with the name Java8.
Additionally, you can create or edit a file .bash_profile (in the directory of your user home) and put the following snippet there:
export JAVA_HOME=/usr/libexec/java_home -v 1.8
Save that file and reopen a Terminal instance. If you execute export as a command there, you should see a valid JAVA_HOME with the location of your JDK 8 installation. Restart your IDE afterwards.
I have the Java 1.8.0_45 SDK installed on OSX Yosemite (10.10.4), but because of a bug in this release I need to go back to 1.8.0_25
I have downloaded and installed the earlier version (1.8.0_25) but even after a reboot java -versionstill shows 1.8.0_45.
I don't really understand where Java resides on OSX, but how can I get my system back so it uses 1.8.0_25
Try and add this to your ~/.bashrc
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
You can have multiple JRE/JDK's installed, by changing this path, you can specify which one you use each time you open a new shell.
Here is what I use in my .bashrc
JAVA_VERSION=7
JAVA_7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
tmp="JAVA_${JAVA_VERSION}_HOME"
export JAVA_HOME=${!tmp}
export PATH=${!j}/bin:$PATH
Here, you can simply change the 7 to an 8.
This will change the JAVA_HOME, and append the bin directory to your path for general use from the command line.
note you may beed to change your java home's according to the specific release versions installed on your machine.
Ah found it, suprisingly easy:
macbook:JavaVirtualMachines paul$ cd /Library/Java/JavaVirtualMachines
macbook:JavaVirtualMachines paul$ ls
jdk1.7.0_40.jdk jdk1.7.0_45.jdk jdk1.8.0.jdk jdk1.8.0_05.jdk jdk1.8.0_20.jdk jdk1.8.0_25.jdk jdk1.8.0_45.jdk
macbook:JavaVirtualMachines paul$ sudo rm -fr jdk1.8.0_45
Eclipse is unable to open, have used eclipse before and has open before without a problem. Now I keep getting the following error message:
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:
Have gotten eclipse to open and work on projects before and won't open.
Here is a screen shot of what I keep getting:
You can explicitly tell Eclipse where to find it. Open eclipse.ini and add the following lines to the top of the file:
-vm
/absolute/path/to/jre6/bin
Update: I just nailed down the root cause on my own Windows machine. The GlassFish installer complained with exactly the same error message and after digging in GlassFish forums, the cause was clear: a corrupt JRE install on a Windows machine. My JRE came along with the JDK and the Java 6 JDK installer didn't install the JRE properly somehow. A DLL file was missing in JDK's JRE installation. After I reinstalled the standalone JRE from http://java.com, overwriting the old one, the GlassFish installer continued and also Eclipse was able to start flawlessly without those two lines in eclipse.ini.
I got this problem because i uninstalled the jdk version 13 and reinstall the jdk version 8
Even though i have updated the path variables eclipse still pick the old configuration.
You need to edit the eclipse.ini file which is in your folder where eclipse.exe is placed.
Just update this file with the latest path so eclipse can pick it up
It usually is because:
you indicated the wrong jvm path in your -vm argument: see this SO question for an concrete example.
the eclipse.ini got corrupted somehow (if it hasn't been modified, this isn't it, but if setting a jvm path doesn't work, ... I would replace the eclipse.ini by one coming from a fresh installation just to be sure)
the java which eclipse search by default is no longer accessible (because the $PATH is no longer up-to-date)
More details on the wiki page "Finding a VM, Using JNI Invocation or Executing Java"
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 we look for a jvm shared library (jvm.dll on window, libjvm.so on *nix platforms) relative to that java executable.
If a jvm shared library is found we load it and use the JNI invocation api to start the vm.
If no jvm shared library is found, we exec the java launcher to start the vm in a new process.
As mentioned in "FAQ How do I run Eclipse?":
Eclipse DOES NOT consult the JAVA_HOME environment variable.
So I would check your $PATH, starting by n new shell sesion (whatever your OS is), typing 'java -version' to see if it still returns anything.
Copy javaw.exe from C:\Program Files\Java\jre1.8(or)1.6(or)1.7\bin
and paste it inside Eclipse folder
where eclipse.exe is there. That's all.
Here is how I fixed mine:
find the location where your jre is installed. in my case, it was located at C:\Program Files\Java\jdk1.7.0_10
copy the jre folder and paste it where your eclipse files are located (where eclipse.exe is located).
when you download eclipse, you get a .zip package containing eclipse.exe and all the other files needed to run eclipse but it is missing the jre files. so all you need to do is to find where jre folder is located on your hard drive and add it to the rest of the eclipse package.
I had the same problem and the issue was that I had a 32 bit version of Eclipse running on my 64 bit machine and it wanted the 32 bit version of JRE.
I changed Program Files to Program Files (x86) in the eclipse.ini file like so:
-VM
C:Program Files (x86)\Java\jre6\bin
and that solved the problem.
You may want to just install the 64 bit Eclipse, but this will take care of the error.
Did you install Java via the java.com web browser auto install? If so, then that's your problem! You need to to the "manual" install: http://www.java.com/en/download/manual.jsp
It's just a matter of having the correct match of 32-bit Eclipse/32-bit Java or 64-bit Eclipse/64-bit Java. Many 64-bit Windows have 32-bit browsers and the latter is the version of Java that the auto-installer will provide - not what the 64-bit Eclipse wants.
Make sure the install path of JDK is in your Path variable in Windows.
adding -vm C:/Program Files/Java/jdk1.6.0_29/bin/javaw.exe to the .ini file helped me.
Is so simple,only add your java path for example:
C:\Program Files\Java\jdk1.8.0_121\bin
in PATH system variable
I have faced the similar issue earlier with Eclipse and STS IDE'S
Please check weather JDK/JRE is available or not in your machine. If not please install JDK and setup the environment variables.
Even after step 1, if you are still facing the issue then it's time to set the vm argument in eclipse.ini or sts.ini in the following way.
-vm
C:Program Files (x86)\Java\jre8\bin
I also had same problem when developing android applications using eclipse IDE.
I solved it by removing all the java installations (I had java 6 and 7 both) and re-install only jdk 7.
I got this fixed by doing the below steps,
1)
The eclipse finds the JAVA executables from 'C:\ProgramData\Oracle\Java\javapath'
The folder structure will contain shortcuts to the below executables,
i. java.exe
ii. javaw.exe
iii. javaws.exe
For me the executable paths were pointing to my (ProgramFiles(x84)) folder location
I corrected it to Program Files path(64 bit) and the issue got resolved
Please find the screenshot for the same.
Just to add on top of other answers:
Windows Users: You can give the PATH to JRE in eclipse.ini separated by '/' or '\'. It doesn't matter. Eclipse will pick it anyway. For example, in my windows system, either of the paths is fine (after -vm of course):
C:/Program Files/Java/jre1.8.0_181/bin
or C:\Program Files\Java\jre1.8.0_181\bin
Change the vm value in eclipse.ini file with the correct path to your JDK something like this,
-vm /Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home/bin
Path to eclipse.ini looks to me something like this,
/Users/tomcat/eclipse/jee-2018-09/Eclipse.app/Contents/Eclipse
This sometimes happen if you remove Java from your path variables.
To set the PATH variable again, add the full path of the jdk\bin directory to the PATH variable. Typically, the full path is:
C:\Program Files\Java\jdk-11\bin
To set the PATH variable on Microsoft Windows:
Select Control Panel and then System.
Click Advanced and then Environment Variables.
Add the location of the bin folder of the JDK installation to the
PATH variable in system variables.
I had this problem too on a win7 machine.
I wanted to update the jre with a jdk. So i deleted the jre folder and downloaded and unzipped the new jdk.
The issue was i manually deleted the jre folder, when instead i should've uninstalled it. This leaves a bunch of registry entries that still point to the old jre. Somehow eclipse still wants to use the old jre.
I couldn't uninstall the old java vm, i kept getting this error:
Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor
So i had to use this MS utility to fix the uninstall:
http://support.microsoft.com/kb/2438651/
Then i had to install again the vm. I installed to the same location the original one was at, to avoid losing another hour! After that eclipse started correctly.
Julio
I just had this problem and fixed it this way. I noticed the error message has jre in it not jre6 or jre7, so i copied jre6 from program files to eclipse folder then renamed it from jre6 to jre, then it worked :p
Newb move on my part, but I had installed just the JRE instead of JDK. Installed JDK and my problem went immediately away.
I had this problem and it was due to my windows machine playing up. I went into control panel -> system -> advanced - environment variables.
I edited the PATH variable (which was already correctly set up), changed NOTHING, clicked OK to come back out of the screens.
Then eclipse worked. No idea why, except because windows. Hopefully this may help someone.
I had this issue; I fixed it by going to
Computer-->Properties-->Advanced Settings-->Environmental Variables
In the System Variables find the variable named PATH.
-->Select Edit
-->At the very end of the Path Variable, put a ";" then add your path of your JDK and put \bin\ at the end
Should be fixed.
Example:
System Variable-
C:\Program Files (x86)\Common Files.......HP\LeanFT\bin
JDK path-
C:\Programs Files\Java\jre1.8.0_121
Final Path -
C:\Program Files (x86)\Common Files.......HP\LeanFT\bin;C:\Programs Files\Java\jre1.8.0_121\bin\
Sources:
https://www.java.com/en/download/help/path.xml
Its simple.
JDK bin directory or JRE bin directory should be in path variable
Example :
Java Installed directory:
Assume your java installed in 'C:\Program Files\java\Jdk1.8.0_144' directory
Now you can find bin directory in 'C:\Program Files\java\Jdk1.8.0_144\bin'
Navigate to user's environment variable
Control Panel --> User Accounts --> User Accounts --> Change my environment variables
In popup click Path under User variables for section
Click Edit... button and another popup will appear
Click New button and enter C:\Program Files\java\Jdk1.8.0_144\bin
Click OK button and again OK button in Environment variables popup.
Now you can open your eclipse without error
I found a solution wherein the Eclipse.ini the location was the old version of Java, and after updating the new version of java the location of
-vm
C:\Program Files\Java\jre1.8.0_201\bin
was same so I had to change the directory to my new version of Java.
So solution is to just open the most updated Java version and copying its directory path and replacing it in the Eclipse.ini file.
Moderately future proof example for Linux-like systems. Assuming javac installed and on your path.
./eclipse -vm dirname $(readlink -f $(which javac))
This will find the directory where javac is installed, and pass as vm argument to eclipse.
If on Linux (ex: Ubuntu 18), try installing (or reinstalling in your case?) default-jre, as follows:
sudo apt update
sudo apt install default-jre
I had the same error when just trying to run the Eclipse installer (./eclipse-inst) on a fresh Eclipse download just now, and the installer wouldn't even run! Installing default-jre solved it!
Source:
https://linux4one.com/how-to-install-eclipse-ide-on-ubuntu-18-04/
In my case I had edited the eclipse.ini for a different purpose to include -vm parameter. That was causing the failure. I removed the -vm and following line where I had included \bin and that fixed the problem.
I got ERROR:
RESOLUTION :
in file eclipse.ini at below location :
make change as :
-vm
C:/Program Files/Java/jdk1.8.0_251/jre/bin/server/jvm.dll
Restart eclipse and error will be resolved
C:\Program Files\Java\jre1.8.0_221\bin
worked for me