Hello Jigsaw-experts,

I’m currently struggling with the 
javax.tools.StandardJavaFileManager#setLocationForModule method and wondering 
if someone could point me in the right direction.

I thought, the setLocationForModule method can be used for referencing a 
dependent module to compile another one.

In an example, I have two modules - api and app. The api module compiles fine. 
When I try to compile the app module, I’m using this to set the path of the 
compiled api module:

fileManager.setLocationForModule(StandardLocation.MODULE_PATH, 
NAME_OF_THE_API_MODULE, List.of(PATH_OF_THE_COMPILED_API_MODULE));

Unfortunately the compiler can’t find that dependent module ("error: module not 
found“ when trying to compile module-info.java).

Also, I’ve noticed, that it perfectly works, if I use 
StandardLocation.SYSTEM_MODULES instead of StandardLocation.MODULE_PATH.

I’ve created a quick demo at 
https://github.com/osiegmar/java9-module-path-compile-problem 
<https://github.com/osiegmar/java9-module-path-compile-problem>


Is it my fault or is it a compiler bug?


Bye

Oliver

Reply via email to