Hello @kartik,
You could run: mvn exec:exec -Dexec.args="arg1".
This will pass the argument arg1 to your program.
You should specify the main class fully qualified, for example, a Main.java that is in a package test would need
mvn exec:java -Dexec.mainClass=test.Main
By using the -f parameter, you can also run it from other directories.
mvn exec:java -Dexec.mainClass=test.Main -f folder/pom.xm
For multiple arguments, simply separate them with a space as you would at the command line.
mvn exec:java -Dexec.mainClass=test.Main -Dexec.args="arg1 arg2 arg3"
For arguments separated with a space, you can group using 'argument separated with space' inside the quotation marks.
mvn exec:java -Dexec.mainClass=test.Main -Dexec.args="'argument separated with space' 'another one'"
Hope this helps and to know more about running Java file, join one of our Java certification course now.