Combining -classpath and module-info?
Alan Bateman
Alan.Bateman at oracle.com
Tue Nov 7 20:43:06 UTC 2017
On 07/11/2017 18:56, Stephan Herrmann wrote:
> I recently noticed that compilers start to ignore -classpath as soon
> as module-info (.java or .class) is found during the compile.
> (Incidentally, javac and Eclipse compiler agree in this).
>
> Using a trivial test class this works:
> $ javac -classpath junit4.jar -d bin/ src/pkg/TestJUnit4.java
>
> This doesn't (cannot resolve any types from junit4.jar):
> $ javac -classpath junit4.jar -d bin/ src/pkg/TestJUnit4.java
> src/module-info.java
The module you are compiling doesn't read the unnamed module. You can't
write "requires $CLASSPATH" for example.
If you add `--add-reads <module>=ALL-UNNAMED` to the command line then
it should compile.
-Alan
More information about the jigsaw-dev
mailing list