简体   繁体   English

Java:无效的源版本:9

[英]Java: invalid source release: 9

I have created a maven project in IntelliJ, I downloaded the dependencies that I need and I can see there are no errors in the code.我在 IntelliJ 中创建了一个 maven 项目,我下载了我需要的依赖项,我可以看到代码中没有错误。

在此处输入图像描述

I am still getting this error even though I have set Java 8 in project in Project Settings即使我在Project Settings中的project中设置了 Java 8 我仍然收到此错误

在此处输入图像描述

This is what my pom.xml looks like:这就是我的 pom.xml 的样子:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>multithreadedCalls</groupId>
    <artifactId>multithreadedCalls</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.10</version>
        </dependency>
    </dependencies>
</project>

Just change java version on the second screenshot只需更改第二张截图上的 java 版本即可

That's how I made it work.我就是这样让它工作的。

File -> settings and then went to this window and updated compiler version from the dropdown.文件 -> 设置,然后转到此 window 并从下拉列表中更新编译器版本。

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 连续获取java:无效源版本:编译时出错1.9 - Continuously getting the java: invalid source release: 1.9 error when compiling intellij 想法 - 错误:java:源代码版本 1.9 无效 - intellij idea - Error: java: invalid source release 1.9 错误:java:无效的源版本:Intellij 中的 8。 这是什么意思? - Error:java: invalid source release: 8 in Intellij. What does it mean? Java 17:java:带有--enable-preview的无效源版本7(预览语言功能仅支持版本17) - Java 17: java: invalid source release 7 with --enable-preview (preview language features are only supported for release 17) 错误:java:带有 --enable-preview 的无效源版本 11(仅版本 15 支持预览语言功能) - Error:java: invalid source release 11 with --enable-preview (preview language features are only supported for release 15) IntelliJ - 无效的源版本:17 - IntelliJ - Invalid source release: 17 从Java 9降级为Java 8时,为什么仍会收到无效的源代码发布错误? - Why do I still get an invalid source release error when downgrading from Java 9 to Java 8? Java 11:错误:java:源代码版本无效:11 - 不知道该做什么了 - Java 11 : Error:java: invalid source release: 11 - Not sure what to do anymore 错误:java:错误:源代码版本无效:13 使用带有 IntelliJ 的 JDK12 - Error:java: error: invalid source release: 13 using JDK12 with IntelliJ IntelliJ 2021.2.2 在编译程序时给出错误“java:错误:无效的源版本:18” - IntelliJ 2021.2.2 gives error 'java: error: invalid source release: 18' when compiling program
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM