• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar - more than 1 main

 
Lars Christian Hansen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java -classpath AppName.jar TR
 
Norm Radder
Bartender
Posts: 1331
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The command: java -jar ...
uses the contents of the jar file's manifest Main-class entry. There is only one per jar file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic