RFR: 8173970: jar tool should have a way to extract to a directory

Alan Bateman Alan.Bateman at oracle.com
Sat Feb 27 08:53:23 UTC 2021

On 26/02/2021 19:47, Lance Andersen wrote:
> Hi Jaikiran,
> Thank you for  the proposed patch.
> Assuming there is consensus to add support for this enhancement, I think we need to discuss what is the correct option.
> The jar tool borrows -C from tar for creating/updating a jar and the -C option is also a valid option when extracting files from a tar file.
> Perhaps keeping symmetry with tar and extend support for -C when extracting a jar file would be a better way forward.   Let’s give time for additional input.
> I believe this would also warrant a CSR to be created as well as updates to the jar man page.
> Best
> Lance
> p.s. I think it would be useful in the future to start the discussion on core-libs-dev prior to creating a PR (or leave it as a draft PR) for a feature request.
I created JDK-8173970 a few years ago so happy it it getting some attention.

Yes, the option name will need to be agreed. It would be useful to 
enumerate the options that the other tools are using to specify the 
location where to extract. If you see JBS issues mentioning tar -C not 
supporting chdir when extracting then it might be Solaris tar, which 
isn't the same as GNU tar which has different options. It might be 
better to look at more main stream tools, like unzip although jar -d is 
already taken. It would be nice if there were some consistency with 
other tools in the JDK that doing extracting (The jmod and jimage 
extract commands use use --dir for example).

There are other discussion points around the behavior when the target 
directory exists or does not exist, to ensure there is some consistency 
with main stream tools.

Yes, a CSR will be needed.


More information about the compiler-dev mailing list