设置类路径的文件夹 [英] Set folder for classpath
问题描述
从命令行,如何将Java CLASSPATH选项设置为指向包含多个jar文件的一个或多个目录?是否存在递归目录和子目录支持的通配符?
From the command line, how do I set the Java CLASSPATH option to point to one or more directories containing multiple jar file? Are there wildcards for recursive directory and sub-directory support?
(我的JAR文件在几个子目录中排序。)
(My JAR files are sorted in several sub-directories.)
推荐答案
如果您使用的是Java 6或更高版本,则可以使用以下格式的通配符:
If you are using Java 6 or higher you can use wildcards of this form:
java -classpath ".;c:\mylibs\*;c:\extlibs\*" MyApp
如果你想添加所有子目录:lib \ a \,lib \ b \,lib \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ p>
If you would like to add all subdirectories: lib\a\, lib\b\, lib\c\, there is no mechanism for this in except:
java -classpath ".;c:\lib\a\*;c:\lib\b\*;c:\lib\c\*" MyApp
没有像 lib \ * \ *
或 lib \ **
您希望完成的工作类型的通配符。
There is nothing like lib\*\*
or lib\**
wildcard for the kind of job you want to be done.
这篇关于设置类路径的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!