32

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

enter image description here

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.

enter image description here

Community
  • 1
  • 1
Fisher Coder
  • 3,278
  • 12
  • 49
  • 84
  • You can still post links to the image, hosted on another (free) image hosting site. One of us could then put it into your question. You need both JRE, and JDK. Not just the one – IAmGroot Oct 23 '14 at 12:45
  • Cool! Thanks @Doomsknight so much for your advice and help! Here's two links to my two screenshots:http://postimg.org/image/6lhfcmjj5/, http://postimg.org/image/5obvozxot/ – Fisher Coder Oct 23 '14 at 18:57
  • http://stackoverflow.com/questions/11170263/specified-jre-installation-does-not-exist – ngrashia Mar 31 '15 at 12:12

8 Answers8

33

I had the same problem. This is how I fixed it.

  1. Open Eclipse.
  2. Go to Preferences.
  3. Click Add
  4. A Window should popup with this:

enter image description here

  1. Select Standard VM.
  2. Select Directory
  3. Use this path: Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/
  4. Click Open
  5. Then Finish
  6. Right click your Project then click Properties
  7. Select Java Build Path then click Add Library
  8. Select JRE System Library

enter image description here

  1. Click Environments and select the jdk1.7.0_45
  2. Finish

This is what you should see if you did it right:

enter image description here

apxcode
  • 7,696
  • 7
  • 30
  • 41
  • This is very helpful! But when I've put that path (Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home) into the directory, I got this message:"The home directory does not exist", I think I can understand this error message as it says, I don't really have this directory set up. Then I searched and found this link: http://stackoverflow.com/questions/10352715/how-do-i-run-eclipse-using-oracles-new-1-7-jdk-for-the-mac. but still it didn't work out for me. I know your response makes me almost there. I'm just missing something. Could you offer any more guidance please? – Fisher Coder Oct 25 '14 at 13:27
  • Try the path with `/Home/` at the end, that might do it. If not try going to the path yourself, folder by folder until you find the `Home`. It might also be that you have a different idk installed, you should find out if you go folder by folder. Start on the `Library/Java/` – apxcode Oct 25 '14 at 18:39
  • I messed something up. OK, I've downloaded two Eclipse on my Mac pro. So, the other one was previously working fine. I mistook it for the nonfunctioning one. Sorry for this. So now when I was trying to make this nonofunctioning one to work and followed your steps, it's not working, so when I tried to use the path, it always says "The home directory does not exist", as this pic shows: http://postimg.org/image/54hu8ngkx/, however, as you taught me, I did look for "/Home/", starting from /Library/, here's the path pic: http://postimg.org/image/cxu9xj4qf/, everything looks right. – Fisher Coder Oct 25 '14 at 20:42
  • But it just still shows "The home directory does not exist", so I'm very confused. Sorry to ask again. But any more help is really appreciated! – Fisher Coder Oct 25 '14 at 20:43
  • 1
    Cool! It works now! Thanks again and sorry for the back and forth! :) – Fisher Coder Oct 25 '14 at 20:49
  • A quick hack is just to import the project into a different workspace which does not throw this error. Inelegant, I know. But works in 30 seconds or less. – CodeMed Apr 13 '15 at 19:12
24

Your run configurations maybe trying to use a specific JRE.

enter image description here

Make sure you are using the correct JRE there.

dwjohnston
  • 11,163
  • 32
  • 99
  • 194
  • This is the only answer that helped, and ideally should be the first thing that is being checked. Just out of curiosity, any reason why the JRE from here gets removed? – GaidinD Aug 21 '18 at 06:34
15

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

Phoenix
  • 1,470
  • 17
  • 23
13

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:

  1. in the global plugin configuration under Eclipse -> Window -> Preferences -> ... of your plugin (typing runtime in the Filter section above may help to find it quickly).

  2. 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 ...
  3. 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 ...
Andreas Covidiot
  • 4,286
  • 5
  • 51
  • 96
2

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

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
1

I had the same problem. This solution might help fix the issue as it did for me.

  1. Right click on the project -> Build Path -> Configure Build Path
  2. In the Libraries tab, select JRE System Library and click Edit
  3. In the Edit window you can either select Workspace default JRE or in Execution environment drop down select the JRE installed
Deeptha AS
  • 47
  • 5
1

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

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

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

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

Muneeb Mirza
  • 810
  • 1
  • 17
  • 35
0

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) enter image description here