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

Support the Manifest Class-Path attribute in jar files on the --processor-path

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • tools

      `javac` initially didn't support the `Class-Path` attribute in Manifest files [1,2] for jar-files on the `--class-path` at all. This support was only added in JDK 5.0 by JDK-4212732 and the documentation of the feature is still pending and currently targeted for JDK 26 (see JDK-8278856).

      `javac` currently doesn't support (i.e. ignores) `Class-Path` attribute in Manifest files [1,2] for jar-files on the `--processor-path`. Java annotation processors can be placed either on the `--class-path` or on the `--processor-path` [3] and the inconsistent handling of the `Class-Path` attribute, depending on whether a jar-file is placed on the `--class-path` or the `--processor-path`, makes it difficult to migrate annotations processors from the `--class-path` to the `--processor-path`.

      Annotation processors are executed in the "runtime environment" as opposed to the "compilation environment" [4]. This distinction is especially important if annotation processors are placed on the `--processor-path`, because in such cases, their dependencies can't be put on the normal `--class-path` but instead have to be placed either on the `--processor-path` as well or they will have to made available directly to the host JVM with the help of `-J--class-path` options.

      It would be helpful if `javac` could be extended such that it honors the `Class-Path` attribute in Manifest files for jar-files on the `--processor-path` such that it adds the attribute's value to the `--processor-path`.


      [1] https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#classpath
      [2] https://docs.oracle.com/javase/tutorial/deployment/jar/downman.html
      [3] https://docs.oracle.com/en/java/javase/24/docs/specs/man/javac.html#annotation-processing
      [4] https://docs.oracle.com/en/java/javase/24/docs/specs/man/javac.html#compilation-environment-and-runtime-environment.

            Unassigned Unassigned
            simonis Volker Simonis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: