问题
I used to have Eclipse configured well and work fine before. But I just uninstalled it and installed Eclipse Juno again on my Mac OS 10.10 today. But I kept getting this error: "The specified JRE does not exist."
I know it's a pretty simple and commonly seen problem, I just needed to install JRE and/or JDK into this clean Eclipse, however things didn't get work out.
And I've searched extensively on Stack Overflow: The posts I've looked at including: How to install JRE 1.7 on Mac OS X and use it with Eclipse? I followed exactly what the accepted answer said, but after having downloaded the JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html and installed it, I was going to add it to Eclipse via Preferences -> Java -> Installed JREs, however, I didn't see it as expected, the following is a screenshot of what I saw when I went to Preferences -> Java -> Installed JREs

But the screenshot just says the installed JREs list is BLANK, I couldn't add any JRE into my Eclipse.
Help please?
Also, I've tried other things that people have suggested: Properties -> Java Build Path what I see here is: JRE System Library OSGi/Minimum-1.2 with a red crossing sign in front of it (indicating something wrong with it?) So, I'm also blocked with this approach.

回答1:
I had the same problem. This is how I fixed it.
- Open Eclipse.
- Go to
Preferences
. - Click
Add
- A Window should popup with this:

- Select
Standard VM
. - Select
Directory
- Use this path:
Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/
- Click
Open
- Then
Finish
- Right click your Project then click
Properties
- Select
Java Build Path
then clickAdd Library
- Select
JRE System Library

- Click
Environments
and select thejdk1.7.0_45
Finish
This is what you should see if you did it right:

回答2:
Your run configurations maybe trying to use a specific JRE.
Make sure you are using the correct JRE there.
回答3:
The problem is generally related to project or plugin-specific runtime configurations that (still) point to some JDK/JRE that is not existing anymore (e.g. after some update or migration).
We had this e.g. with the ANT plugin, where the launch configuration had to be updated (per ant build file), if it was e.g. not set to the default ~ run in same JRE as workspace
.
You will find these settings (typicall under the JRE
tab) either:
in the global plugin configuration under
Eclipse -> Window -> Preferences -> ...
of your plugin (typingruntime
in theFilter
section above may help to find it quickly).or it is set in a project/file-specific run configuration which you should see if you go to
Eclipse -> Run -> Run configurations...
or- right click on your project/file and select
Run As -> Run Configurations ...
or it is set in a project/file-specific external tool configuration (e.g. like used by ANT) which is similarly to be found here:
Eclipse -> Run -> External Tools -> External Tools Configuration ...
or- right click on your project/file and select
Run As -> External Tool Configurations ...
回答4:
In eclipse click Window –> Show view –> Servers
Once you are in servers view double click configured server to open its configuration and click Runtime environment link (in the left side).
Select the JRE and click finish.
Hope it help you
回答5:
I had the problem with one particular run configuration (unittests for one project in my case). In Run Configurations, I selected the troubled run configuration, then the JRE tab, and I could see it was broken (even though I couldn’t tell how it had happened). Selecting the right JRE solved my problem (project JRE in my case, even though this was just my standard JRE and not configured for the project specifically).
回答6:
I had the same problem. This solution might help fix the issue as it did for me.
- Right click on the project -> Build Path -> Configure Build Path
- In the Libraries tab, select JRE System Library and click Edit
- In the Edit window you can either select Workspace default JRE or in Execution environment drop down select the JRE installed
回答7:
This happened to me when I updated Java. Though it was updated in my system, it didn't update the references in eclipse. I was working on web projects so I had to do the following steps
Windows > Preferences > Java > Installed JREs (here the old version was present without showing any error) > Remove any old versions that are not present in your system and Add latest release or the present ones.
Confirm Build Path of your projects and confirm they are pointing at the correct JRE. Project > Build Path > Check JRE version is correct
After doing this my project still gave me the same error so I checked JRE for my tomcat servers setup in eclipse
- Window > Preferences > Server > Runtime Enviroments > Select each server and edit it, reselect the jre and apply (it took me some time here to make eclipse realise i had the correct JRE selected).
Thats it, try running now it it should work.
回答8:
Main Cause of this Error is You Maybe forgot the set Build patch. When you Import Old Project this time Old Java Build Patch Existing You Have to give New One which one you currently using in your work space.
Process:- Right Click Project -> Build patch -> Configure Build path-> Add Library-> System Library-> Set JRE (Default or Alternative)
来源:https://stackoverflow.com/questions/26477692/eclipse-the-specified-jre-installation-does-not-exist