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

Alan Bateman alan.bateman at oracle.com
Sun Dec 8 06:43:14 UTC 2024


This mailing list is a general discussion list, it's not the place to 
bring support questions.

In this case, I think your starting point has to be security-dev as it's 
about stripping security classes and dealing with whatever breakage and 
side effects that might bring. So I think start there and explain what 
you are trying to do.

As regards jlink, the option you found is for excluding files, such as 
launchers, from the run-time image, it's not about classes/resources.

-Alan


On 08/12/2024 03:15, Dimitri John Ledkov wrote:
> 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/20241208/15e00ca8/attachment-0001.htm>


More information about the discuss mailing list