2

For the java command line tool, there is now the --module-path option as a replacement for the --class-path (or -cp) option.

With the classpath option, you can specify wildcards to include all jars in a given directory. E.g.:

java -cp "main.jar:lib/*" com.company.app.Main

Doing the same with the module path does not seem to work. Are wildcards possible there?

Omid
  • 5,823
  • 4
  • 41
  • 50
Wim Deblauwe
  • 25,113
  • 20
  • 133
  • 211

1 Answers1

2

The --module-path option expects a list of directories separated by : (at least on macOS and Linux).

From java -help:

--module-path <module path>...
              A : separated list of directories, each directory
              is a directory of modules.

So if there is a lib directory with all jar files, use something like this:

java --module-path "main.jar:lib" --module mymodule/com.company.app.Main
Wim Deblauwe
  • 25,113
  • 20
  • 133
  • 211