Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Executing different methods in a Jar file  (Read 3325 times)

0 Members and 1 Guest are viewing this topic.

zscipio

    Topic Starter


    Rookie

    Executing different methods in a Jar file
    « 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.

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Executing different methods in a Jar file
    « Reply #1 on: April 03, 2009, 03:42:57 PM »
    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.

    zscipio

      Topic Starter


      Rookie

      Re: Executing different methods in a Jar file
      « Reply #2 on: April 04, 2009, 07:56:47 AM »
      No this is not a homework assignment, No I Had not read the page.  I can use the java -cp theprogram.jar form.