Link to home
Start Free TrialLog in
Avatar of StealthyDev
StealthyDev

asked on

Java Help - JAR File

Dear Experts,

I have a jar file with 2 main classes. I want to execute the jar file specifying some input to start with different main program at different times. How to do that?

package order:
com.utility
-mainclass1.class
-mainclass2.class

It is packaged into classes.jar.

Best Regards.
SOLUTION
Avatar of ksivananth
ksivananth
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of StealthyDev
StealthyDev

ASKER

Can you please send the content of batch file?

I normally use:
java -jar jarname.jar
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks to objects and all other experts who replied in seconds..

Thanks again!

Solution I have used:
java -cp classes.jar com.utility.mainclass1
java -cp classes.jar com.utility.mainclass2


Regards.
ops, soory! :-)
First of all get familiar with MANIFEST.MF file and you will fix this.
@Veleri: How to specify multiple Main Class in MANIFEST.MF ?