how to run 1 or more main classes in a jar?

Hi there,

I have 2 or more main classes in a java project. How do I create more than one application entry point in my MANIFEST.INF? I create my jar file from my java project using Eclipse, and it asked me to "Select the class of the application entry point". I was only able to select one main class.

I noticed the MANIFEST.INF file that eclipse generated looks like:

Manifest-Version: 1.0

Main-Class: Automobile

When I tried to run my other classes not specify in the MANIFEST.INF it failed and only look for the Automobile class:

java -jar /tmp/Auto.jar TestMe

[606 byte] By [cup_joea] at [2007-11-27 11:18:27]
# 1

java -cp yourjarfile.jar OneOfTheClasses

atmguya at 2007-7-29 14:30:59 > top of Java-index,Desktop,Deploying...
# 2

Your app. can have as many entry points as you like, as atmguy demonstrated. But you can only specify one in the manifest,which - if you think about it - makes perfect sense. How is the machine to determine - from you clicking on the jar - which entry point you meant to invoke?

georgemca at 2007-7-29 14:30:59 > top of Java-index,Desktop,Deploying...
# 3

Thanks the command works!

cup_joea at 2007-7-29 14:30:59 > top of Java-index,Desktop,Deploying...