How to include all the jars present at a particular directory in the CLASSPATH in one go? [duplicate]

隐身守侯 提交于 2019-12-09 07:41:31

问题


I have around hundreds of jars at a particular directory which my application uses. So I thought its hard to add each jars one by one to the classpath. So is there any command or any way so that i can add all the jars at one go. some *.jar should add all the jars.


回答1:


Yes, you can use a wildcard, as of Java6. See the section on "Understanding class path wildcards"

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.

Prior to Java 6, you had to specify them all individually.



来源:https://stackoverflow.com/questions/5857321/how-to-include-all-the-jars-present-at-a-particular-directory-in-the-classpath-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!