134

I am using IntelliJ IDEA 10. Every time when I create a new project, it is asking me to choose JDK for this project. Anyone know how I can configure it and make it easy to use?

3

4 Answers 4

306

If you are on Mac OS X or Ubuntu, the problem is caused by the symlinks to the JDK. File | Invalidate Caches should help. If it doesn't, specify the JDK path to the direct JDK Home folder, not a symlink.

Invalidate Caches menu item is available under IntelliJ IDEA File menu.

Direct JDK path after the recent Apple Java update is:

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

In IDEA you can configure the new JSDK in File | Project Structure, select SDKs on the left, then press [+] button, then specify the above JDK home path, you should get something like this:

JDK 1.6 on Mac

4
  • 1
    I tried the same on OS X 10.8 with IntelliJ IDEA 11.x and 12.x EAP and it does not solve the problem. I do have both Java 1.6 from Apple and Java 1.7 from Oracle but the problem is consistent with both of them.
    – sorin
    Nov 25, 2012 at 11:48
  • 1
    Follow this bug, this could be the cause youtrack.jetbrains.com/issue/IDEA-95789
    – sorin
    Nov 25, 2012 at 12:16
  • 1
    the jdk path may change from version to version, to find out the path: which java in terminal, it prints /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java and then use Home dir path to input in IntelliJ idea dialog, like this /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home May 1, 2018 at 4:36
  • I had multiple SDK configs on my intellij, removing the bad configurations resolved the problem for me. Thanks :) Jan 21, 2022 at 10:49
17

Just tried this recently and when trying to select the JDK... /System/Library/Java/JavaVirtualMachines/ appears as empty when opening&selecting through IntelliJ. Therefore i couldn't select the JDK...

I've found that to workaround this, when the finder windows open (pressing [+] JDK) just use the shortcut Shift + CMD + G to specify the path. (/System/Library/Java/JavaVirtualMachines/1.6.0.jdk in my case)

And voila, IntelliJ can find everything from that point on.

0
11

The JDK path might change when you update JAVA. For Mac you should go to the following path to check the JAVA version installed.

/Library/Java/JavaVirtualMachines/

Next, say JDK version that you find is jdk1.8.0_151.jdk, the path to home directory within it is the JDK home path.

In my case it was :

/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home

You can configure it by going to File -> Project Structure -> SDKs.

enter image description here enter image description here

-4

On Mac IntelliJ Idea 12 has it's preferences/keymaps placed here: ./Users/viliuskraujutis/Library/Preferences/IdeaIC12/keymaps/

1
  • This doesn't help answer the original question Apr 27, 2018 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.