Reputation:
What is the meaning of '*'
... in this example line?
javac -classpath .:classes:/opt/pi4j/lib/'*' ...
Upvotes: 0
Views: 51
Reputation: 644
The wildcard character *
is quoted to stop the shell trying to expand it at the time you enter the command line.
However, according to this page from the Oracle Java documentation the classpath itself can evaluate wildcard characters:
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. Files will be considered regardless of whether or not they are hidden (that is, have names beginning with '.').
A class path entry that contains * will not match class files. To match both classes and JAR files in a single directory foo, use either foo:foo/* or foo/*:foo. The order chosen determines whether the classes and resources in foo are loaded before JAR files in foo, or vice versa.
Subdirectories are not searched recursively. For example, foo/* looks for JAR files only in foo, not in foo/bar, foo/baz, etc.
If you don't understand *
at all then you need to follow How to Use Wildcards
Upvotes: 1