最佳答案
我正在使用IntelliJ IDEA Ultimate 2019.3.1。每当我尝试启动任何简单的Java Maven项目(可能它甚至是一个简单的Hello World),我得到以下错误:
Error:java: error: release version 5 not supported
通过终端运行java --version
,我得到以下输出:
openjdk 11.0.5 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.1)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.1, mixed mode, sharing)
通过终端运行javac --version
,我得到以下输出:
javac 11.0.5
转到Java编译器的设置(建议在这里),我看到这样:
我尝试将“目标字节码版本”编辑为1.8,但我得到以下错误:
Error:(1, 26) java: package javafx.application does not exist
Error:(2, 20) java: package javafx.stage does not exist
Error:(4, 27) java: cannot find symbol
symbol: class Application
Error:(12, 23) java: cannot find symbol
symbol: class Stage
location: class Main
Error:(7, 9) java: cannot find symbol
symbol: method launch(java.lang.String[])
location: class Main
Error:(11, 5) java: method does not override or implement a method from a supertype
将其更改为1.11版本,我会得到这个错误:
Error:java: Source option 5 is no longer supported. Use 6 or later.
你认为是什么问题?我该怎么解决呢?