I have a compiled project in a jar file and I need to call a method from it.How can I do that in ubuntu terminal?
You can not call any method from terminal or cmd of any class.
You can execute class through terminal.
If your jar
is executable try: java -jar "Name of your Jar"
Or set the class path of your jar: java -classpath path-to-jar <package>.<classname>
java -cp path/to/jar <package>.<classname>
example:
java -cp test.jar org.dekz.HelloWorld
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