module-info compilation on legacy JDK

Remi Forax forax at univ-mlv.fr
Fri Sep 2 18:32:20 UTC 2016


Hi Henry,
there are two ways to do that,
-with javac, you first compile all your .java files but the module-info.java with --release 6 (or -source 6 -target 6 -Xbootclasspath ...) then you compile the module-info.java with --release 9.
-with a bytecode tool like ASM, you don't need a module-info.java in that case, because you can generate it, so you compile all your classes with javac --release 6 and you generate the module-info.class with the bytecode tool.

BTW, the right list for this kind of questions is still jigsaw-dev.

cheers,
Rémi

----- Mail original -----
> De: "Henri Tremblay" <henri at tremblay.pro>
> À: "jdk9-dev" <jdk9-dev at openjdk.java.net>
> Envoyé: Vendredi 2 Septembre 2016 19:53:52
> Objet: module-info compilation on legacy JDK

> Hi,
> 
> I might not have look hard enough but I can't find a documentation about it.
> 
> So I figured here is a good place to ask. I'm pretty sure this was
> discussed before.
> 
> I would like to provide a jar that is a JDK 9 module but that can run on
> older JDK. So a jar that is compiled for Java 6 for instance but that still
> have the module-info.java.
> 
> How can I do that?
> 
> Do I need to compile everything in Java 6 and then module-info.java in Java
> 9?
> 
> Or am I supposed to deliver 2 different jars?
> 
> Thanks,
> Henri


More information about the jdk9-dev mailing list