Forums Register Login

call a jar in the command

+Pie Number of slices to send: Send
Hi, I generated a jar out of my java project, and I want to invoke it in the command.
The problems are:
1. The class I want to turn to is in a package.
2. I want to invoke specific method in it

My class that contain the method to invoke is: myClass
The method I want to invoke inside myClass :myMethod
The jar file name is : myJar
The package name is: myPackage.

Should I write in the command:

java -jar myJar.myPackage.myClass.myMethod ???

Thanks.
+Pie Number of slices to send: Send
From the command line you can invoke only the main() method of the specified class!
+Pie Number of slices to send: Send
ok, so how do i invoke the main:
java -jar myJar.myPackage.myClass ?
thanks
+Pie Number of slices to send: Send
ok, I have it, thank a lot!
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 492 times.
Similar Threads
Chap.10 Development , Q5 pg813 : not understood answer and cannot run code
Question about java and javac commands
call main-method inside jar
main without string args[ ]
Reflection and classpath
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:08:25.