javaspring-bootmavenjava-8spring-tools-4

How to resolve Error: Could not find or load main class in SpringBoot application


I have one SpringBoot application with maven setup. When I run maven clean, install, generate-sources , build succeed but when I run it as spring boot application, it gives error Error: Could not find or load main class

For trial I created simple java hello world project in the same workspace which is working fine. So this issue is not related with classpath variables or JDK.

Can you tell me what wrong I might be doing in SpringBoot application?


Solution

  • Please try giving the main class in the POM file, as shown below.

    [ if main class is 'com.dev.webapp.Application' ]

    <properties>
        <start-class>com.dev.webapp.Application</start-class>
    </properties>