Computer Hope
Software => Computer programming => Topic started by: zscipio on April 01, 2009, 12:48:12 PM
-
A jar file has many methods in it. When I run the following: java -jar TheProgram.jar T the main method in TheProgram is executed with a parameter of T.
Is there a way to execute one of the other methods in TheProgram.jar, say otherMethod(), by saying something like java -jar TheProgram.jar /otherMethod T?
Thank you.
-
Is this a homework assignment?
Basically a JAR is a compressed file that can have java applets.
Have you already read this page?
http://java.sun.com/developer/Books/javaprogramming/JAR/basics/
If you had, I don't understand your question. If a method is manifest yopur could use it, otherwise no.
But if the jar file is not locked, you can modify or extract what you want and put it into a new jar or some other form.
-
No this is not a homework assignment, No I Had not read the page. I can use the java -cp theprogram.jar form.