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

David Holmes dholmes at openjdk.org
Thu Jan 15 23:23:43 UTC 2026


On Thu, 15 Jan 2026 19:58:03 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: fixed Windows build issue and moved asserts as per @dholmes

Changes requested by dholmes (Reviewer).

test/hotspot/jtreg/runtime/CommandLine/PrintClasses.java line 65:

> 63:     pb.command(new PidJcmdExecutor().getCommandLine("VM.classes", "-location"));
> 64:     output = new OutputAnalyzer(pb.start());
> 65:     output.stdoutContains(".*(file:/|jar:).*");

This won't report any failures - it is a boolean function. You need to use `stdoutShouldContain`.

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

PR Review: https://git.openjdk.org/jdk/pull/29048#pullrequestreview-3668061308
PR Review Comment: https://git.openjdk.org/jdk/pull/29048#discussion_r2696311622


More information about the serviceability-dev mailing list