1 year ago

#71764

test-img

Captain Jacky

"no main manifest attribute" when building .jar (Gradle)

I've been trying many different things throughout various posts, but none of the solutions have helped me.

  1. Creating an artifact through Build -> Build artifacts..., selecting directory for META-INF/MANIFEST.MF as main\resources and running a generated jar file throws no main manifest attribute.

  2. <..>, selecting directory for META-INF/MANIFEST.MF as main\java and running a generated jar file returns Could not find or load main class.

My MANIFEST.MF:

Manifest-Version: 1.0
Main-Class: <package>.MainApplication

Also, in my build.gradle I have:

jar {
    manifest {
        attributes 'Main-Class': '<package>.MainApplication'
    }
}

I have tried creating a new project, but the problem persisted the same. I hope someone could help me. Thank you.

UPDATE:

Demo project example (FileMail), which produces my error.

Demo project example (MediaFire)

UPDATE 2:

Demo project 2 example

java

intellij-idea

jar

manifest.mf

0 Answers

Your Answer

Accepted video resources