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

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 12
    • tools
    • None
    • behavioral
    • minimal
    • new system property, for use with source launcher (only)
    • System or security property

      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.

            jjg Jonathan Gibbons
            jrose John Rose
            Alan Bateman, Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: