问题
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 entryfoo/*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