[错误:-source 8-Intellij Idea中不支持模块

问题描述 投票:-1回答:1

我正在使用jdk 11.0.6,并单独使用gradle与javaFX插件。运行程序时,intellij给我错误

4:46:44 PM: Executing task 'run'...

> Configure project :
Found module name 'Notes'

> Task :compileJava FAILED
C:\Users\fahid\IdeaProjects\Notes\src\main\java\module-info.java:1: error: modules are not supported in -source 8
module Notes {
^
  (use -source 9 or higher to enable modules)
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
1 actionable task: 1 executed
4:46:45 PM: Task execution finished 'run'.

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9xV2Jpbi5wbmcifQ==” alt =“ ScreenShot -1”>“截图-2”

我该如何解决?

注意-我在项目结构和模块部分都选择了jdk11。(屏幕截图)。

java javafx java-8 java-11
1个回答
0
投票

错误说

-source 8中不支持模块

您正在尝试使用Java 9功能模块将其编译为Java8。删除module-info文件

© www.soinside.com 2019 - 2024. All rights reserved.