I have a program which runs as a Spring boot App in eclipse. The program was running fine. Then i did the following:
Right click on project -> Run As -> Maven Test .
This was accidental. When i then tried to run the program as a spring boot app again, it threw the following error below.
Error: Could not find or load main class com.bt.collab.alu.api.webapp.Application
How do i point the application back to my main class? Thanks
A Spring Boot application's main class is a class that contains a public static void main() method that starts up the Spring ApplicationContext. By default, if the main class isn't explicitly specified, Spring will search for one in the classpath at compile time and fail to start if none or multiple of them are found.
If you are running a Spring Boot based application and you are getting could not find or load main class in spring boot . Make sure your maven is building the classes properly and Java Home is set properly. Exception in thread “main” java. lang.
I had the same problem. Try this :
Right Click the project -> Maven -> Update Project
Then Re-run the project. Hope it work for you too.
Main class is configurable in pom.xml
<properties> <start-class>com.bt.collab.alu.api.webapp.Application</start-class> </properties>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With