Intellij错误:(3,4)java:-source 8不支持模块(使用-source 9或更高版本启用模块)[已解决] [英] Intellij Error:(3, 4) java: modules are not supported in -source 8 (use -source 9 or higher to enable modules) [SOLVED]

查看:112
本文介绍了Intellij错误:(3,4)java:-source 8不支持模块(使用-source 9或更高版本启用模块)[已解决]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑-解决此问题-通过设置以下问题解决:设置->构建,执行,部署-Java编译器->项目字节码版本:9"

我正在

我将项目级别设置为9:

我收到错误:(3,4)java:-source 8中不支持模块(使用-source 9或更高版本来启用模块)",在尝试构建/运行项目的主类时发生错误.

是的,我已经看到

错误:

平台SDK:

依赖性面板:

FWIW,iml文件的内容显示语言级别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"><排除输出/>< 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"><排除输出/>< 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-name ="common.widgets"/></component></module> 

解决方案

此问题已解决-该问题通过以下设置解决:设置->构建,执行,部署-Java编译器->项目字节码版本:9"

感谢所有花时间尝试提供帮助的人.

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>

解决方案

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.

这篇关于Intellij错误:(3,4)java:-source 8不支持模块(使用-source 9或更高版本启用模块)[已解决]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆