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

source file mode for JVM should provide a hook to locate the source file

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 12
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      new system property, for use with source launcher (only)
    • Interface Kind:
      System or security property

      Description

      Summary

      Add a system property to get the filesystem path of the source file when the source launcher is being used.

      Problem

      There is currently no way to access the filesystem path of the source file containing the classes in source-launcher mode. It would be convenient to have access to that value in some cases, typically in order to access related resources. This is essentially the same problem that gives rise to the use of $0 for the name of the script file when using some shell-scripting languages.

      Solution

      Provide a system property whose value is the filesystem path for the source file.

      JDK-8210274 suggests that the code source for any classes should be set to the source file, to enable security permissions to be granted in a policy file. However, using the code source is not as obvious or as convenient as a system property.

      Specification

      The name of the property is jdk.launcher.sourcefile. It will only be set when source-launcher mode is being used: i.e. while the compiled classes are being executed. The value is the absolute filesystem path of the file containing the source that was compiled and is being executed.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jjg Jonathan Gibbons
              Reporter:
              jrose John Rose
              Reviewed By:
              Alan Bateman, Mandy Chung
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: