Suppose I have a lib.jar library for which I do not have source code (or it is written in some non-lingual language that does not yet know about modules). lib.jar does not have module-info.class , and I do not want to use it as an automatic module, so I would like to add module-info.class to it.
First I create module-info.java with the following command:
jdeps --generate-module-info . lib.jar
Suppose this creates something like this:
module lib { exports package1; exports package2; }
Then I try to compile it, but javac fails because packages package1 and package2 do not exist:
> javac module-info.java module-info.java:4: error: package is empty or does not exist: package1
Of course, I can create the directories package1 and package2 with dummy classes in them, but is there any better approach?
java java-9 module-info java-module
Zhekakozlov
source share