aspose file tools*
The moose likes Java in General and the fly likes Jar - more than 1 main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Jar - more than 1 main" Watch "Jar - more than 1 main" New topic
Author

Jar - more than 1 main

Lars Christian Hansen
Greenhorn

Joined: May 05, 2005
Posts: 9
Hi,

suppose I have an application with more than 1 main class. I have jar'ed the file and now depending on the situation, wanna be able to call on or the other main class. Is that possible via the command line?

I was thinks something in the lines of(TR.class is one of the main classes):

java -jar AppName.jar TR

But doesn't seem to work

Regards

Lars
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

java -classpath AppName.jar TR


[Jess in Action][AskingGoodQuestions]
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
The command: java -jar ...
uses the contents of the jar file's manifest Main-class entry. There is only one per jar file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jar - more than 1 main