Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8279296

Jar -C option with multiple directories

    XMLWordPrintable

Details

    • jar
    • generic
    • generic

    Description

      ADDITIONAL SYSTEM INFORMATION :
      I am using the "openjdk-17-jdk" package from Ubuntu on WSL2, and comparing it to the oracle jdk on windows.

      A DESCRIPTION OF THE PROBLEM :

      I believe I have uncovered a bug (or a disagreement?) in the usage of the jar command.

      In the man page for jar on my system it is stated:

             -C DIR Changes the specified directory and includes the files specified at the end of the command line.

                    jar [OPTION ...] [ [--release VERSION] [-C dir] files]

      as well as in the documentation for oracle's jar:

             -C dir

                    Temporarily changes directories to dir while processing the following inputfiles argument. Multiple -C dir inputfiles sets are allowed.
             [...]
                    Temporarily changes directories (cd dir) during execution of the jar command while processing the following inputfiles argument. Its operation is intended to be similar to the -C option of the UNIX tar utility.

      Yet whenever I specify a single -C in my Makefile I get the following error:

             jar cfe target/release.jar FutureTesting.Test -C target FutureTesting/Test.class FutureTesting/WebService.class
             FutureTesting/WebService.class : no such file or directory
             make: *** [Makefile:18: target/release.jar] Error 1

      To workaround the issue I have to inconveniently use -C target multiple times:

             jar cfe target/release.jar FutureTesting.Test -C target FutureTesting/Test.class -C target FutureTesting/WebService.class




      FREQUENCY : always


      Attachments

        Activity

          People

            adev ANUPAM DEV
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: