JavaFX does not exist using Java 9 and Intellij Idea

File --> Project Structure-->Module

The language level in here as set to 5 for me. Upped it to 9 to allow classes etc and the same error as described above resolved for me.


I had this problem after upgrading a JavaFX project from Java 8 to Java 9.

After checking the usual language level settings for the project and module in IntelliJ and the Maven pom, I found the problem was that the module was explicitly set to generate Java 8 bytecode in the Java Compiler preferences.

Look in Preferences -> Build, Execution, Deployment -> Compiler -> Java Compiler. Check that Project bytecode version is unset (or set correctly) and that your module is not listed in Per-module bytecode version with an incorrect value.


Try to set project language level to "9" in "Project Structure | Project"


Okay I see what my problem was.

Besides Try to set project language level to "9" in "Project Structure | Project" mentioned above, I had a maven setting in some pom.xml looks like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven-compiler-plugin.version}</version>
    <configuration>
        <source>${java.version}</source>
        <target>${java.version}</target>
    </configuration>
</plugin>

and java.version was defined as 1.8 somewhere above. I just had to change it to 9