2

I am trying to create a new JavaFX project. I have 1.8 installed which I believe includes the javafx packages. Running javac -version in the terminal shows javac 1.8.0_121. I installed from here

When I go to File -> Project Structure -> Project the selected version is 1.6. There is no 1.8 version in the list. If I select add new, and navigate to /System/Library/Frameworks/JavaVM.framework/Versions I see:

1.4
1.4.2
1.5
1.5.0
1.6
1.6.0

There is no 1.8 version.

How can I update IntelliJ to user version 1.8?

Andremoniy
  • 34,031
  • 20
  • 135
  • 241
BugHunterUK
  • 8,346
  • 16
  • 65
  • 121
  • 1
    I'm no Mac expert but `/System/Library/Frameworks/JavaVM.framework/Versions` does not sound like the path of the JDK. – Michael Feb 07 '17 at 15:18
  • After a bit of googling, `/System/Library/Java/JavaVirtualMachines/` sounds like the place to look. – Michael Feb 07 '17 at 15:23
  • @Michael there is no `/System/Library/Java/JavaVirtualMachines` directory. I'm on El Capitan if that helps. How can I find out where it's stored? – BugHunterUK Feb 07 '17 at 16:06
  • @Michael http://i.imgur.com/GPn1net.png ... Doesn't exist. – BugHunterUK Feb 07 '17 at 16:23
  • Maybe you must configure your IDE to use that location? http://stackoverflow.com/questions/18987228/how-do-i-change-the-intellij-idea-default-jdk#18987229 – FibreFoX Feb 08 '17 at 13:14

3 Answers3

6

The location for the SDK can be found by running: echo $(/usr/libexec/java_home)

Which reveals:

/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
BugHunterUK
  • 8,346
  • 16
  • 65
  • 121
  • Hi, could you explain how the command `echo $(/usr/libexec/java_home)` works? Edit: found it http://stackoverflow.com/a/18144853/1092133 – Bajal Feb 07 '17 at 17:02
1

If you have installed Java with brew. /Users/{username}/.sdkman/candidates/java/current

To show .sdkman in finder

Press Cmd+Shift+. to show hidden files in the file chooser dialog. https://guides.codepath.com/android/setting-up-intellij-idea

Anders B
  • 3,343
  • 1
  • 26
  • 17
0

Quite late to this party, today I had the same problem. The right answer I think is use jenv

brew install jenv openjdk@8
jenv add /usr/local/opt/openjdk@8

And then add into Intellij IDEA as new SDK the following path:

~/.jenv/versions/1.8/libexec/openjdk.jdk/Contents/Home/
freedev
  • 25,946
  • 8
  • 108
  • 125