File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Android Security Essentials Live Lessons this week in the Android 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: 24183
    
  34

java -classpath AppName.jar TR


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

Joined: Aug 10, 2005
Posts: 685
The command: java -jar ...
uses the contents of the jar file's manifest Main-class entry. There is only one per jar file.
 
Don't get me started about those stupid light bulbs.
 
subject: Jar - more than 1 main
 
Similar Threads
jar deploy
name of a jar
cann't find jar files in jar file
Monitoring standalone java program
SOAP Connection