I recently downloaded JDK 1.8.0.0_06 that comes bundled with NetBeans. I then got to find out that my JavaFx project, that I have been developing in Java 1.7 won\'t compile in J
Maven setting:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Alternatively, I checked the pom.xml and changed
<java.version>1.8</java.version>
to
<java.version>1.7</java.version>
None of the previous solutions worked for me.
I solved it by editing .idea/compiler.xml There were "extra" (1) and (2) copies of the bad module with different targets. I deleted the extraneous entried and changed the targets in the section to 1.8 and it worked.
Installing a newer release of IDEA Community (2018.3 instead of 2017.x) was solved my issue with same error but java version:11. Reimport hadn't worked for me. But it worth a try.
For IntelliJ14 you may have to change the bytecode version w.r.t. the JDK you are using (in the global settings):
If this error occurs when running a Gradle (or Maven) task, you need to modify that build tool configuration to point to your installation of Java JDK 1.8 following this route:
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
There you check the Linked Gradle project is the one you are working on and select the Gradle JVM (You missed this when you imported the gradle project into IntelliJ)
Remember when importing a Gradle (or Maven) project to set the target JVM correctly here: