Is this possible to call a specific method (other than main) of a class in a jar file from command line?
If you are talking about running Java code from the command-line, then no.
You can specify a class name, but not which method to call, that always has to be public static void main(String[] argv).
What you could do is write a helper class (or script like BeanShell) to do that.
java -cp theJar.jar;. my.helper.WrapperClass theClassToCall theMethodtoCall arg1 arg2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With