two mains in one jar

A

Ann

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?
 
M

Mike Schilling

Ann said:
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.
 
F

Ferenc Hechler

what about adding a Switch-Main-Class which parses the command-line and
starts Main1 or Main2 based on the parameters?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top