Combining -classpath and module-info?

Stephan Herrmann stephan.herrmann at berlin.de
Tue Nov 7 18:56:04 UTC 2017


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

Similarly if -sourcepath is used or module-info.class exists in bin/ .

In my reading, JEP 261 explicitly allows this situation, but before I fix this
on our side, I'd like to know whether this *is* a bug or intended behavior.

thanks,
Stephan


More information about the jigsaw-dev mailing list