IDEA启动Springboot报错:无效的目标发行版:17 的解决办法

时间:2025-01-28 08:29:41

无效的目标发行版:17 的解决办法 
一般有两个原因,一可能是本地没有安装JDK17,需要安装后然后在IDEA中选择对应版本;二可能是因为IDEA版本太低,不支持17,需要升级IDEA版本。然后在File->Project Structure->Project Settings下的Project和Modules配置成应用所需jdk版本

改成jdk1.8后报错:
Caused by: : org/camunda/bpm/spring/boot/starter/runlistener/PropertiesListener has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognize

Exception in thread "main" : org/springframework/boot/SpringApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at .defineClass1(Native Method)
	at (:763)
	at (:142)
	at (:467)
	at $100(:73)
	at $(:368)
	at $(:362)
	at (Native Method)
	at (:361)
	at (:424)
	at $(:331)
	at (:357)
	at xpl..(:13)

主要是代码编译时使用的jdk版本与运行时使用jdk版本不一致导致的(即IDEA运行时选择的jdk版本比实际项目需要的低);新版本的IDEA最新支持到21了,但是我的是低版本的IDEA,所以需要升级IDEA才能选择到对应版本。需要修改的地方有以下几处: