且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在类路径中使用通配符添加多个jar?

更新时间:2023-11-18 22:08:34

来自: http://java.sun.com/javase/6 /docs/technotes/tools/windows/classpath.html


类路径条目可以包含基本名称通配符 * ,被认为等同于指定扩展名为.jar或.JAR的目录中所有文件的列表。例如,类路径条目 foo / * 指定名为foo的目录中的所有JAR文件。简单地由 * 组成的类路径条目扩展为当前目录中所有jar文件的列表。

Class path entries can contain the basename wildcard character *, which is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR. For example, the class path entry foo/* specifies all JAR files in the directory named foo. A classpath entry consisting simply of * expands to a list of all the jar files in the current directory.

这应该适用于Java6,不确定Java5

This should work in Java6, not sure about Java5

(如果它看起来不能按预期工作,请尝试使用引号。例如:foo / *

(If it seems it does not work as expected, try putting quotes. eg: "foo/*")