This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to start a specific class in a package?

 
D. Formenton
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sirs,

I have a .jar package with several form (form1, form2, etc.) where each form has a main() function.

The question is: it is possible to select at run time the form to be started?
I.e. it exist a command like "java -jar mypackage.jar ...???" that permit to start a particular form?

thank you

Domenico
 
Henry Wong
author
Marshal
Pie
Posts: 21115
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, one option is to not use the "-jar" option, and call the class directly...

java -cp mypackage.jar Form1

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic