编辑-这已解决-该问题已通过以下设置解决:“设置->生成,执行,部署-Java编译器->项目字节码版本:9”
我正在https://www.logicbig.com/tutorials/core-java-tutorial/modules/getting-started-in-intellij.html上查看示例/教程
这不是Maven项目。我在项目结构中将源级别设置为9,例如
我将项目级别设置为9:
我收到“错误:(3,4)java:-source 8中不支持模块
(使用-source 9或更高版本启用模块)”,在尝试构建/运行项目的主类时发生错误。
是的,我已经看到Intellij IDEA 2018.1 Jdk10 cannot run test了,但是没有答案。
我刚刚将Intellij更新为2019.2.4,但问题仍然存在。我正在使用SDK 11。
如何解决?谢谢。
编辑:运行/调试配置选项:
编辑:错误:
编辑:平台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">
<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>
最佳答案
这已解决-通过设置解决问题:“设置->构建,执行,部署-Java编译器->项目字节码版本:9”
感谢所有花时间尝试提供帮助的人。