RFR: 8327246: Add a jcmd diagnostic command to list the jar files loaded by a process [v8]

David Holmes dholmes at openjdk.org
Fri Jan 16 20:23:53 UTC 2026


On Fri, 16 Jan 2026 18:52:11 GMT, Larry Cable <duke at openjdk.org> wrote:

>> modified the pre-existing VM.classes jcmd to add a 'location' option, that when specified, will (natively) attempt to obtain the value (if non-null) of the location URL of the CodeSource of each classes ProtectionDomain.
>> 
>> effectively:
>> 
>> someObject.getClass().getProtectionDomain().getCodeSource().getLocation().toExternalForm()
>> 
>> (where interim oops are null-checked)
>
> Larry Cable has updated the pull request incrementally with one additional commit since the last revision:
> 
>   JDK-8327246: updated jcmd.md to document -location flag

Changes requested by dholmes (Reviewer).

src/jdk.jcmd/share/man/jcmd.md line 807:

> 805:         `R` = has been redefined, `S` = is shared class (BOOLEAN, false)
> 806: 
> 807:     -   `-location`: (Optional) Print the location of the class file from which the class is loaded (if available)

Suggestion:

    -   `-location`: (Optional) Print the location from which the class was loaded (if available).

src/jdk.jcmd/share/man/jcmd.md line 808:

> 806: 
> 807:     -   `-location`: (Optional) Print the location of the class file from which the class is loaded (if available)
> 808:          If provided by its defining ClassLoader, this option will print a URL specifying the location of the 

I don't think this is an accurate description. The location comes from the `CodeSource` which comes from the `ProtectionDomain`, which is supplied to the `ClassLoader` when defining the Class.

If we want to be specific here then I would suggest:

If available from the Class (through its ProtectionDomain's CodeSource), this option will print ...

-------------

PR Review: https://git.openjdk.org/jdk/pull/29048#pullrequestreview-3672561766
PR Review Comment: https://git.openjdk.org/jdk/pull/29048#discussion_r2699840495
PR Review Comment: https://git.openjdk.org/jdk/pull/29048#discussion_r2699855216


More information about the hotspot-dev mailing list