Home > Blockchain >  Can't set up Spring boot project in intelliJ (Cannot load class error)
Can't set up Spring boot project in intelliJ (Cannot load class error)

Time:02-04

I installed maven on my MacOs device. Then I watched this tutorial on how to create a new Spring Boot project on intelliJ. https://www.youtube.com/watch?v=YDRNMAJo0MA When I press build project I get an error. This is the error I get:

java.util.concurrent.ExecutionException: com.intellij.diagnostic.PluginException: Cannot load class dev.flikas.spring.boot.assistant.idea.plugin.suggestion.filetype.YamlPropertiesFileType (
  error: dev/flikas/spring/boot/assistant/idea/plugin/suggestion/filetype/YamlPropertiesFileType 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 55.0,
  classLoader=PluginClassLoader(plugin=PluginDescriptor(name=Spring Boot Assistant, id=dev.flikas.idea.spring.boot.assistant.plugin, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/IdeaIC2021.2/plugins/idea-spring-boot-assistant, version=0.17.2, package=null), packagePrefix=null, instanceId=67, state=active)
)

Above it says that this version of Java runtime only recognises class file versions up to 55.0 which is java 11. I created this Spring project firstly as java 17 project because on my macOs I have java 17 installed(I also have 11.0.12). Then in the pom.xml file I changed it to 11.0.12. Also on my project structure I changed it to JDK 11.

I also tried changing my default jdk version on my macOs with this tutorial https://medium.com/@devkosal/switching-java-jdk-versions-on-macos-80bc868e686a When I use this line export JAVA_HOME=/usr/libexec/java_home -v 11.0.12 and then write java -version it says that my jdk is java 11.0.12 but when I reset terminal and write java -version again it says that it's jdk 17. I also wrote export JAVA_HOME=/usr/libexec/java_home -v 11.0.12 in my bash profile.

I don't know what I have to do.

CodePudding user response:

Since you are just importing the generated Spring Boot POM application, in this case, you may just Disable the third-party plug-in Spring Boot Assistant(Settings > Plugins > Installed, disable it) then restart your IDEA and everything should work.

If you still want to use that plugin, make sure you are using the latest version of IDEA CE(at this time it's 2022.3.2) and install the Spring Boot Assistant plugin again.

  • Related