How to generate executable jar of a gradle project which does not have main class(main method)?

Hi gradle team,

I have a standalone project that does not contain any main method in any class. I have to create a executable jar file to run this project and use it for my task. When I am creating executable jar using gradle build command and running it, it gives me “no main manifest attribute”. Please help me, how can I create the correct executable jar?
Please for reference have a look on the project that i want to run.

Hello @basant123

i am new to gradle also but i am not sure what you mean with executable jar but without main class

what you mean by task here
“. I have to create a executable jar file to run this project and use it for my task”

gradle task or something else?

if you want to produce jar as library you can use this java library plugin
https://docs.gradle.org/current/userguide/java_library_plugin.html

hope that help and have a nice day :slight_smile:

Hi @justsomeone,

Thank you for your quick response. Actually, I have shared the github url of the application in question. The application is a texture_atlas-creator (creating single atlas using multiple images). This application is a standalone tool and API and it does not have any main method.
for more understanding about this application, please follow the documentation

documentation URL : texture-atlas-creator/TextureAtlasCreator-Documentation.doc at master · 3dcitydb/texture-atlas-creator · GitHub

Now, as per documentation, for creating atlas using multiple images, I need to run executable jar of the application into command line using command
“java -jar executable-jar.jar [algorithm] [width] [height] inptu output”
The problem is in this tool/api, there is no main method in any class, so when i am creating executable jar and running it using command line, it gives "no main manifest attribute " in the executable-jar.
I hope you will understand the issue now.

Thnak you, Have a beautiful and peaceful day.

Hello @basant123

you welcome

according to this comment

they removed the cli support

cause my humble understand to java that i need main method in a class which be the main Class to the jar
jar become executable by having main class

so maybe you need to create that class based on how this api work

or maybe wait maybe i miss something and other would help :slight_smile:

@justsomeone, Thank you so much for your valuable reply.

you very welcome @basant123