Issue
I want to create a shell script which when called run the following command mvn exec:java -Dexec.mainClass="location_of_class_file" -Dexec.args="parameter";
Solution
First of all, if you use Maven, you can specify your main class in the pom file. This value will be parsed and will be stored in the manifest file of the jar. So the argument -Dexec.mainClass="location_of_class_file"
can be omitted.
If maven (mvn) is in your PATH variable, you can directly paste your command inside <filename>.sh
and execute it.
You can create the <filename>.sh
with touch
. Remember to give it execute permissions with chmod
. E.g. if your filename is let's say "hui" (that's a common filename used for testing) it will look like:
touch hui.sh
chmod u+x hui.sh
Answered By - hovanessyan Answer Checked By - Mary Flores (WPSolving Volunteer)