I am trying to get started with IntelliJ IDEA, however I am not able to set the JDK path. which java returns /usr/bin/java, however IDEA is not able to find the specified path. Expanding bin in the tree from within IDEA shows an unending tree of X11. I also tried /usr/share/java, but that gives an error 'specified path not a directory for JDK' How do I set the JDK path?


The error message is quite clear:

specified path not a directory for JDK

/usr/bin/java it is not a directory to JDK is command for running compiled java programs .class files.

For setup JDK in IntelliJ go to Project Structure in section Platform Settings choose SDKs and add path to JDK usually on Ubuntu it installed in /usr/lib/jvm/. After that in section Project Settings choose Project tab and finally select added JDK:

enter image description here

|improve this answer|||||
  • usr/lib/jvm doesn't exist on my system – Anuraag Baishya Nov 14 '15 at 6:31
  • 1
    @AnuraagBaishya What way did you used for installing JDK ? And also say me what command echo $JAVA_HOME will print. – Anton Dozortsev Nov 14 '15 at 13:25
  • I installed java using webupd8 ppa. Also echo $JAVA_HOME doesn't return anything. The thing is IDEA doesn't work, however Android Studio which is based on IDEA works perfectly. – Anuraag Baishya Nov 14 '15 at 16:53
  • @AnuraagBaishya You have any configuration in SDKs (as on screenshot) section in Android Studio ? If so add the same configurations in IntelliJ. – Anton Dozortsev Nov 14 '15 at 17:21
  • 2
    You need to download an oracle jdk - unpack tar.gz and point Project SDK to unpacked dir – Kirill Mikhailov Nov 28 '17 at 16:09

As Kirill Mikhailov pointed out, using oracle jdk instead of the already installed open jdk has solved the issue for me
I'm using Intelij 2017.2 CE

|improve this answer|||||
  • Issue was with Linux not finding the correct folder due to some reason, I had Oracle JDK. Also, IntelliJ works equally well with Open JDK. This issue has been resolved long back :) – Anuraag Baishya Jan 4 '18 at 9:30
  • Yes switching to oracle-java-8 solved my issue too. – Dipen Mar 21 '18 at 22:30

I'm using Ubuntu 18.04 LTS and fresh IDEA 2019.2.

I have met the same problem and solved it by installing several openjdk packages. "openjdk-8-jdk" alone is not enough.

For OpenJDK 8 (1.8) you need to install:

sudo apt install openjdk-8-demo openjdk-8-doc openjdk-8-jdk openjdk-8-source

For OpenJDK 11:

sudo apt install openjdk-11-demo openjdk-11-doc openjdk-11-jdk openjdk-11-source

Then both SDKs are recognized correctly (choose one of subfolders in /usr/lib/jvm/ folder).

|improve this answer|||||
  • Since Oracle JDK is no longer free to use like it used to, not to mention old answers are already old, this answer is very helpful now. – matt Aug 7 '19 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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