简体   繁体   中英

How do I add Java 1.8 to IntelliJ (OSX)

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 ?

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

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

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM