Search code examples
javaubuntuintellij-ideajava-8intellij-13

Selected directory is not a valid home for JDK - Intellij IDEA on Ubuntu


After installing Intellij Idea 14, with OracleJDK 1.8 u25 (64 bit) on my 14.04 Ubuntu system, I cannot configure the Java SDK to use any JDK. When I navigate to Module Settings->SDK and click configure SDK, the add button, and then select /usr/java/jdk1.8.0_25 in the dialog, I get an error popup stating that "The selected directory is not a valid home for JDK."

I've checked the contents of the directory, which contains a bin folder with both java and javac inside, a lib folder and a jre folder.

I've tried selecting each of those in turn, to no avail, which I expected.


Solution

  • Evan Knowles posted a link to https://askubuntu.com/questions/130186/what-is-the-rationale-for-the-usr-directory. It provided me with the solution to the problem.

    Instead of using the JDK at /usr/java/jdk1.8.0_25, I instead used the JDK at /usr/local/java/jdk1.8.0_25. The reasons that this works rather than the other are explained in detail within the link.