1

I am trying to use JDK 7 with my Java project. JRE 7 is installed:

[Macintosh-2:~] Moby% java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

In Eclipse, I select the compiler Java 1.7:

enter image description here

and Java JRE 1.7 is installed:

enter image description here

But I get a facet version mismatch. In project facets, I cannot even choose Java 1.7:

enter image description here

Why does Java 1.7 not display in facets?

I have seen this post, and it does not help.

Community
  • 1
  • 1
Roy Hinkley
  • 10,111
  • 21
  • 80
  • 120
  • Is this a maven project by any chance? – Asaph May 11 '15 at 21:14
  • No. Maven is not used in this project. – Roy Hinkley May 11 '15 at 21:15
  • What build system are you using? I'm betting the build file specifies source and/or target = 1.6. – Asaph May 11 '15 at 21:18
  • Also, I couldn't help but notice that you referred to "JRE" 1.7 in your question multiple times. Please note that you need the "JDK", not the "JRE" if you want to compile code. JRE is just the runtime. JDK includes the compiler. – Asaph May 11 '15 at 21:20
  • I have not specified a build system yet. It's a new project and I am just trying to define some basic settings. JDK 1.7 is installed. – Roy Hinkley May 11 '15 at 21:22
  • 1
    What is output of the following command? (run in terminal): `/usr/libexec/java_home`. Whatever the output of that command is, make that your Installed JRE location instead of what you have in your screenshot (`/Library/Java/Home`). – Asaph May 11 '15 at 21:24
  • What is the output of `/Library/Java/Home/bin/java -version`? Is that a path to a `1.6` jdk? – Asaph May 11 '15 at 21:29
  • 1
    @Asaph That worked (`/usr/libexec/java_home`). I updated Eclipse and all is good. Please move your last comment to answer. Thank you! – Roy Hinkley May 11 '15 at 21:29
  • On my system, JDK 1.7 was installed to `/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home`, not `/Library/Java/Home`. – Asaph May 11 '15 at 21:29
  • @Asaph I flagged the comment that should be answer. – Roy Hinkley May 11 '15 at 21:31

1 Answers1

1

Your configured path for your jre7: /Library/Java/Home is actually pointing to your jdk6 installation. Change /Library/Java/Home to whatever the output of this command is: /usr/libexec/java_home.

Asaph
  • 159,146
  • 25
  • 197
  • 199