• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Gradle SpringBoot: Could not find main class

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
My gradle file contains:


And Main SpringBoot class contains:



After clean build, I run my application with:
        java -jar build/libs/file_util.jar -cp build/classes/java/main/ com.example.fileutil.FilePrepareApplication

And receive the error: java.lang.NoClassDefFoundError: com.example.fileutil.FilePrepareApplication

What am I doing wrong?
 
Bartender
Posts: 2419
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nick,
You can try to create a separate class that implements the CommandLineRunner and annotate it with @Component.
Put your FilePrepareApplication in the root directory of your project. See if it works.
 
reply
    Bookmark Topic Watch Topic
  • New Topic