File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running alternate class in jar file

 
Tom McAmmond
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that if I specify the main class in a jar file's manifest I can just run



But what if I have two classes in the jar file with a main() method, say a utility.class and a mainclass.class, and once in a while I want to run that utility.class instead? Is there a way to do that? Or do I have to remove the main-class from the manifest?

Thanks for any help
 
Tom McAmmond
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forget it - I answered my own question. For the curious (because I always hated reading someone's question that was like mine that later only said "I figured it out"), you do it like this:

java -cp jarfile.jar classname
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic