Search This Blog

Saturday, May 22, 2021

Solved : Can't execute jar- file: “no main manifest attribute”

 

Recently i was facing this when containerized a Spring boot microservcie with docker. 

I was using gradle to create JAR. 

When Looked at the issue, entry point was missing in Manifest file in created JAR which caused this error. 

Can't execute jar- file: “no main manifest attribute”

Solution : 

1. Run task bootJar in case using gradle to create a bootable jar. It will update manifest with main java file. 

Or 

2. As an alternate option you can use JAR command with to create entry point in manifest. Similar to below :

jar cfe app.jar MyApp MyApp.class

Cheers,

Kapil 

No comments:

Post a Comment

Thanks for your comment, will revert as soon as we read it.

Popular Posts