How to inject module declaration into JAR?

Yes, this is possible with the --patch-module option. This option is most often used at runtime, but it also works at compile time:

javac --patch-module <module name>=<path to jar> module-info.java

Leave a Comment