I have a groovy script Automate.groovy. The script does not have a class definition or a main method. I am looking for the simplest way to create a jar containing the script. I tried compiling the groovy script using the following command:
groovyc Automate.groovy
I also have a Manifest file manifest-addition.txt that specifies the main class
Main-Class: Automate
And I created the jar using the command:
jar cvfm Automate.jar mainfest-addition.txt *.class
This gave me a jar with Automate.class and Automate$1.class and a Manifest file with the Main class. But when I tried to run the jar using java -jar Automate.jar I always get the error
cannot find or load main class Automate.
What am I doing wrong here?
There should be a simple way like this to create the jar. I just have this one script file that I want in my jar and I do not want to use maven/ant/gradle to get this job done. Isn't there a simple and straightforward way to do this?