I need to call a method from it.
This is not a very specific operator. if you are interested in calling the main method of your main class, you can do
java -jar path/to/yourjar/yourJar.jar
if you want to call a method from this class from another class, you need to add this jar to your classpath, and then you can access other methods. but since you wrote from the terminal, I assume that the first approach is suitable for you.
Jigar joshi
source share