'Intellij Error:(3, 4) java: modules are not supported in -source 8 (use -source 9 or higher to enable modules)
Edit - this is solved - the issue was solved by setting: "Settings -> Build, Execution, Deployment - Java Compiler -> Project Bytecode Version : 9"
I'm following the example/tutorial at https://www.logicbig.com/tutorials/core-java-tutorial/modules/getting-started-in-intellij.html
This is NOT a maven project. I have set the source level to 9 in the project structure eg
I have set the project level to 9:
I am getting "Error:(3, 4) java: modules are not supported in -source 8 (use -source 9 or higher to enable modules)" error when trying to build/run the project's main class.
And yes I have seen Intellij IDEA 2018.1 Jdk10 cannot run test which is unanswered.
I have just updated Intellij to 2019.2.4 but the issue remains. I am using SDK 11. How can this be fixed? Thanks.
Edit: the Run/Debug configuration options:
Edit: the error:
Edit: the platform SDK:
Edit: the dependencies panel:
FWIW, the contents of the iml files show language level 9:
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_9" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_9" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="common.widgets" />
</component>
</module>
Solution 1:[1]
This is solved - the issue was solved by setting: "Settings -> Build, Execution, Deployment - Java Compiler -> Project Bytecode Version : 9"
Thanks to all who gave their time to try to help.
Solution 2:[2]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | JL_SO |
Solution 2 | Vinay Prajapati |