Results 1 to 2 of 2
  1. #1
    SteM is offline Member
    Join Date
    Nov 2007
    Posts
    6
    Rep Power
    0

    Default Calling jar classes from java executable

    Hi all,
    I have a java application in the form of exe file (Windows).
    From this application i need to load an external jar and execute it.
    Using methods Class.forName(), getMethod() amd invoke() I made some steps but I have some problems.
    I'm able to instanciate the main class in the jar but when the code instances another class (in the jar) I receive a java.lang.NoSuchMethodError exception.

    In general :
    :confused: how can i load all the classes contained into the jar archive?
    :confused: which classes defined in the second app i can invoke from the first one?
    :confused: which classes defined in the first app i can invoke from the second one?
    :confused: if I should have the same class in both app, what happens?

    Thanks a lot !! :)

  2. #2
    sandeepkk2005 is offline Member
    Join Date
    Nov 2007
    Posts
    18
    Rep Power
    0

    Default

    If you want to invoke it as a separate application then use

    Runtime.getRuntime.exec("java -jar yourJarFileName.jar");

    if u want to use the functions(or methods) then put the jar file in classpath, import it & create the object and use the methods.

Similar Threads

  1. convert a java binary/executable to a intermediate language
    By sumit_400461 in forum Advanced Java
    Replies: 1
    Last Post: 07-13-2008, 08:04 PM
  2. Executable Java
    By eva in forum New To Java
    Replies: 3
    Last Post: 12-31-2007, 12:38 AM
  3. Replies: 2
    Last Post: 11-11-2007, 09:07 AM
  4. Running java classes with XML
    By ai_2007 in forum Advanced Java
    Replies: 1
    Last Post: 06-29-2007, 04:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •