0

In bash, I would like to specify all .jar files under a directory to the option -cp of javac (and later java when running the compiled program).

But

$ javac  -cp /home/hibernate-release-4.3.11.Final/lib/required/*.jar *.java
javac: invalid flag: /home/hibernate-release-4.3.11.Final/lib/required/dom4j-1.6.1.jar
Usage: javac <options> <source files>
use -help for a list of possible options

Is it because the expansion of *.jar files are separated by but not : which is required by -cp?

Is there a way that works without me to manually specify all the .jar files under a directory?

Thanks.

  • I suspect your question can be answered using the duplicate link. If not, then edit your question and tell us where you got stuck. – Tim Biegeleisen Dec 12 '17 at 01:20
  • If your shell expands the `*` as a shell wildcard (globbing), you need to quote it. (Standard Posix Shell behaviour ...) – Stephen C Dec 12 '17 at 01:22

0 Answers0