IDEA運行Java項目報錯java: 錯誤: 不支持發(fā)行版本 xx的解決方法
報錯場景:
IDEA運行Java項目報錯,點擊運行之后,IDEA在編譯代碼的時候就出現(xiàn)報錯:
報錯類型一:java: 錯誤: 不支持發(fā)行版本 21 報錯類型二:java: 錯誤: 無效的源發(fā)行版:21
詳細報錯如下:
Executing pre-compile tasks... Running 'before' tasks Checking sources Copying resources... [spring6-ioc-annotation] Checking dependencies… [spring6-ioc-annotation] Dependency analysis found 0 affected files Updating dependency information… [spring6-ioc-annotation] Searching for compilable files... [spring6-ioc-annotation] Parsing java… [spring6-ioc-annotation] java: 錯誤: 不支持發(fā)行版本 21 Dependency analysis found 0 affected files Errors occurred while compiling module 'spring6-ioc-annotation' javac 17 was used to compile java sources Finished, saving caches… Module 'spring6-ioc-annotation' was fully rebuilt due to project configuration/dependencies changes Compilation failed: errors: 1; warnings: 0 Executing post-compile tasks... Compilation failed: errors: 1; warnings: 0 Synchronizing output directories... 2024/3/5 10:28 - Build completed with 1 error and 0 warnings in 4 sec, 114 ms
截圖如下:

報錯原因:
Javac編譯器的版本與JDK版本不對應(yīng)
解決方法:
參考以下文章:
保持文章里面4大點的版本一直即可:
- ①File——>Project Structure——>Project;
- ②File——>Project Structure——>Modules;
- ③File——>Project Structure——>SDKs;
- ④File——>Settings——>Build, Execution, Deployment——>Compiler——>Java Compiler。
例如,我這里是第四點的版本不一致:

到此這篇關(guān)于IDEA運行Java項目報錯java: 錯誤: 不支持發(fā)行版本 xx的解決方法的文章就介紹到這了,更多相關(guān)Java錯誤不支持發(fā)行版本內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
struts2.3.24+spring4.1.6+hibernate4.3.11+mysql5.5.25開發(fā)環(huán)境搭建圖文
這篇文章主要介紹了struts2.3.24+spring4.1.6+hibernate4.3.11+mysql5.5.25開發(fā)環(huán)境搭建圖文教程,感興趣的小伙伴們可以參考一下2016-06-06
java?JVM-clinit指令實現(xiàn)原理面試精講
這篇文章主要介紹了java?JVM-clinit指令實現(xiàn)原理面試精講,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-10-10
詳解JAVA生成將圖片存入數(shù)據(jù)庫的sql語句實現(xiàn)方法
這篇文章主要介紹了詳解JAVA生成將圖片存入數(shù)據(jù)庫的sql語句實現(xiàn)方法的相關(guān)資料,這里就是實現(xiàn)java生成圖片并存入數(shù)據(jù)庫的實例,需要的朋友可以參考下2017-08-08
使用EasyPOI實現(xiàn)多sheet動態(tài)列導出
這篇文章主要為大家詳細介紹了如何使用EasyPOI根據(jù)指定時間范圍創(chuàng)建動態(tài)列,以及如何將數(shù)據(jù)組織成符合要求的格式并導出,感興趣的可以了解下2025-03-03

