Search code examples
javaintellij-ideajavafxintellij-14

The selected directory is not a valid home for JDK - IntelliJ JavaFX JDK on windows


I am new to Java programming. I wanted to learn JavaFX and from this I installed the SDK. I was using this video to setup the SDK but even I set the JAVA_HOME directory, I always get the error:

The selected directory is not a valid home for JDK.


Solution

  • Within intellij:

    File -> Project Structure -> Libraries

    click the "plus" button to add a new library, click "Java", and point to the lib directory in your JavaFX SDK directory.

    example: C:\Users\sparrow\.jdks\javafx-sdk-15.0.1\lib

    This information is documented in the "Getting Started" guide on the openjfx.io website.

    https://openjfx.io/openjfx-docs/#IDE-Intellij