Can jlink --exclude-files exclude a single class from lib/modules?

Dimitri John Ledkov dimitri.ledkov at surgut.co.uk
Sun Dec 8 03:15:29 UTC 2024


Hi,

I have tried all invocations of jlink with --exclude-files and failed to
make it exclude anything at all.

I was hoping to exclude SunRsaSign.class from the java.base jmod if at all
possible:

rm -rf /tmp/myjre
jlink --output /tmp/myjre
--exclude-files='glob:/java.base/**/SunRsaSign.class' --add-modules
java.base
jimage list /tmp/myjre/lib/modules | grep SunRsaSign.class
    sun/security/rsa/SunRsaSign.class

But trying any other patterns to exclude anything else, seems to have no
effect and everything is always included.

If I want to really exclude a class, do I need to rebuild the jmod first
too?

Is there any working example of --exclude-files which shows invocation
without it preserving a given file in the resulting modules?

Did I completely misunderstand the feature and --exclude-files is only to
exclude other toplevel files in the output jre directory, and cannot affect
what ends up in the /modules file (partial jmod inclusion)?

-- 
Regards,

Dimitri.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/discuss/attachments/20241207/ffbd963c/attachment.htm>


More information about the discuss mailing list