简体   繁体   中英

Q: No main manifest attribute, and Could not find or load main class. How do I structure the Main Manifest attribute for Gradle?

I have been trying to compile my jar file into an executable jar file. I learned that I need to set the Main Manifest from my first error. My problem is that whatever I try to put in as the fully qualified name for the Main class, It still tells me that the class isn't found.

Things I've tried

  1. Not using a package and just putting Main as the Main-Manifest
  2. Using a package and putting (packagename).Main
  3. (packagename).Main.class
  4. Pressing Ctrl+Shift+Alt+C which supposedly copies the fully qualified name and putting that in

I've tried looking at tons of previous questions and couldn't find anything, I've probably spent like 10 hours on this and would appreciate it if someone could help me. I think that I am somehow incorrectly structuring what I'm supposed to put in.

Thank you in advance!

For anyone having future problems, try and use shadow to build your project, fixed my problem even though the error didn't say it was missing dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM