jlink with an existing output directory

Alan Bateman Alan.Bateman at oracle.com
Fri Apr 12 14:32:31 UTC 2024


On 12/04/2024 14:06, Fabian Meumertzheim wrote:
> Hi,
>
> I noticed that jlink fails if the directory specified with --output 
> already exists. This makes it less convenient to use the tool with 
> build systems that pre-create output directories and expect build 
> actions to fill them (e.g. Bazel).
>
> Would you accept a change that loosens the check to allow for the 
> directory to exist as long as it is empty?
>
Not sure. The directory is created atomically so as to prevent races. If 
changed to allow an empty directory then you risk concurrent steps in 
the build writing to the same location. I recall we discussed this in 
the JDK 9 time frame but don't have time right now to find these 
discussions.

-Alan


More information about the jigsaw-dev mailing list