Menu

Obfuscating with Java 9

Help
2017-12-14
2017-12-19
  • Mark Phipps

    Mark Phipps - 2017-12-14

    Hello, I hope you can help with a Java 9 build problem that I am having.

    Using the ANT task, when obfuscating with Java 8, I include rt.jar as a library jar:
    ...
    <proguard>
    -libraryjars "${java.home}/lib/rt.jar"
    -libraryjars "${repository.dir}/${mail.jar}"
    ...

    But now trying to obfuscate with Java 9, there is no rt.jar so I substituted with jrt-fs.jar:
    ...
    <proguard>
    -libraryjars "${java.home}/lib/jrt-fs.jar"
    -libraryjars "${repository.dir}/${mail.jar}"
    ...

    However this leads to failure with many errors where Proguard cannot reference core library clasess such as:
    ...
    [proguard] Warning: blah.blah.blah: can't find superclass or interface java.lang.Object
    ...

    There is obviously some difference in the way that the Java 9 runtime serves classes from its module system, so I guess I should ask first of all, does Proguard support Java 9?

    Any advice appreciated.

    Many thanks
    Mark

     
  • Eric Lafortune

    Eric Lafortune - 2017-12-14

    ProGuard 6.0, currently at beta 1, supports Java 9. However, this beta version doesn't support jmod files as intended -- the fix will be in beta 2. Java 9 stores the Java runtime as a set of jmod files instead of a single rt.jar. You can still use an older rt.jar file for the time being (probably with -ignorewarnings for some missing classes).

     
  • Mark Phipps

    Mark Phipps - 2017-12-15

    Eric,

    Many thanks for your response. I will try that.

    Do you have an idea of timescale for releases of 6.0?

    Regards
    Mark

     
  • Paul Russell

    Paul Russell - 2017-12-19

    +1 for this please, too. Trying to use with Maven Plugin and java9

     

    Last edit: Paul Russell 2017-12-19