Home > OS >  Error: Could not find or load main class com.javacourse.springBootDemo.SpringBootDemoApplication
Error: Could not find or load main class com.javacourse.springBootDemo.SpringBootDemoApplication

Time:08-24

In Eclipse, when I try to run my SpringBootDemoApplication, it gives me this error:

Error: Could not find or load main class com.javacourse.springBootDemo.SpringBootDemoApplication 
Caused by: java.lang.ClassNotFoundException: com.javacourse.springBootDemo.SpringBootDemoApplication

I have also tried some solutions on Package Explorer

My Maven and Java Versions :

Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: C:\apache-maven-3.8.5
Java version: 11.0.16, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.16

Thank you all in advance, hope we can solve this vexed issue.

CodePudding user response:

Did you try to run the app using the CLI? To discard is it only an eclipse issue

./mvnw spring-boot:run

CodePudding user response:

I have finally solved it. To anyone encountering the same issue and couldn't find a solution : Try to change the project folder destination and move it in C:\ directory. I actually don't know the reason yet but I think that maybe it's related to Maven, JDK or Classpath visibility through C:. But that was the only solution for me.

  • Related