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?
Solution 1:
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:
Solution 2:
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).
Solution 3:
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