execute a main class from a jar

后端 未结 3 784
余生分开走
余生分开走 2020-12-30 21:05

I have a jar which contain two main class Class A and Class B. In the manifest i have mentioned Class A . Now i have to execute classB from the same jar . what should be the

相关标签:
3条回答
  • 2020-12-30 21:52

    Why don't you create a Main class that accepts an argument? That argument will decide whether to execute Class A or Class B then.

    0 讨论(0)
  • 2020-12-30 21:54

    Use a command-line switch to identify whether Class A or Class B should be executed.

    0 讨论(0)
  • 2020-12-30 22:09

    This will do the job: java -classpath yourjar.jar youpackage.B

    0 讨论(0)
提交回复
热议问题