Issue
If I setup a maven project and write a Java program with main method, I want to convert this program to an equivalent shell script. In other words, the shell script should accept the arguments and should behave in the same way that the java program would behave when main method is called with arguments. How do I achieve this?
Solution
You can use shell script's variable arguments to achieve this. First you can write your logic in Java and then pass all the arguments from shell script to it.
#! /bin/bash
java <class_name> $@
$@ will pass all the arguments to the Java program.
Answered By - Prashant
Answer Checked By - Candace Johnson (JavaFixing Volunteer)