Ubuntu – Unable to set JDK path in IntelliJ IDEA


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?

Best Answer

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