我有一个fizz.jar
,其中包含一个具有主要入口点的FizzDriver
类:
public class FizzDriver {
public static void main(String[] args) {
if(args.length == 1 && args[0] != null)
processFile(args[0]);
}
// Expects "fileName" to be something like "whatever.log".
public static void processFile(String fileName) {
// Process the file
}
}
我已确保MANIFEST.MF
将Main-Class
设为我的FizzDriver
。
现在,fizz.jar
需要4个其他JAR作为依赖项:
a.jar
b.jar
c.jar
d.jar
如何从命令行运行fizz.jar
(FizzDriver
),同时将文件名作为唯一的arg传递给它,以及包含my的类路径4个JAR依赖项?
到目前为止,我最好的尝试是:
java -jar fizz.jar -cp a.jar b.jar c.jar d.jar "whatever.log"
但这不起作用。想法?提前谢谢!