two mains in one jar

Discussion in 'Java' started by Ann, Nov 14, 2004.

  1. Ann

    Ann Guest

    I have an application that produces a set of
    jpg files. I jar it up and everything is great.
    I also have a utility program I use to view the
    jpgs. I put all of this in a single jar file and set
    Main-Class: NewDraw
    (name of the first prog) in the manifest file.
    java -jar NewDraw.jar
    runs the first program.
    How can I run the second program?
    Ann, Nov 14, 2004
    #1
    1. Advertising

  2. "Ann" <> wrote in message
    news:i7Pld.406128$D%.62364@attbi_s51...
    >I have an application that produces a set of
    > jpg files. I jar it up and everything is great.
    > I also have a utility program I use to view the
    > jpgs. I put all of this in a single jar file and set
    > Main-Class: NewDraw
    > (name of the first prog) in the manifest file.
    > java -jar NewDraw.jar
    > runs the first program.
    > How can I run the second program?
    >


    Don't use the -jar flag. Instead, list the jar in the classpath, and name
    the second program's class on the command line.
    Mike Schilling, Nov 14, 2004
    #2
    1. Advertising

  3. what about adding a Switch-Main-Class which parses the command-line and
    starts Main1 or Main2 based on the parameters?
    Ferenc Hechler, Nov 15, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    552
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,687
    muttley
    Oct 20, 2005
  3. cyberco
    Replies:
    4
    Views:
    3,722
    Roedy Green
    Feb 14, 2006
  4. multiple mains()

    , Feb 24, 2006, in forum: C Programming
    Replies:
    9
    Views:
    351
    Keith Thompson
    Feb 24, 2006
  5. bicomplex
    Replies:
    0
    Views:
    160
    bicomplex
    Jan 10, 2008
Loading...

Share This Page