How to inject module declaration into JAR?

前端 未结 2 1883
面向向阳花
面向向阳花 2020-11-28 10:43

Suppose I have some library lib.jar for which I do not have the source code (or it is written in some non-Java language which is unaware of modules yet).

相关标签:
2条回答
  • 2020-11-28 11:27

    Alternatively, to compile the module-info.java generated you need to also extract the contents of the JAR to a directory.

    Then compile the module-info.java with the output directory (-d) set to the directory where you extracted the contents.

    Credits :- Alan

    0 讨论(0)
  • 2020-11-28 11:29

    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
    
    0 讨论(0)
提交回复
热议问题