简体   繁体   中英

execute a main class from a jar

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 command.

I dont prefer to make two separate jars.

Thanks

这将完成这项工作: java -classpath yourjar.jar youpackage.B

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.

使用命令行开关来识别是应该执行A类还是B类。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM