On Mon, 8 Jun 2026 14:40:55 GMT, Kevin Walls <[email protected]> wrote:

> Add a "-location" option to jcmd VM.classes which will show the URL of the 
> class if possible. e.g.
> 
> 769483:
> KlassAddr           Size  State                 Flags    ClassName
> 0x0000000055040400    71  fully_initialized     W        MyApp$1  
> "file:///my/progs/"
> 0x0000000055040000    67  fully_initialized     W        MyApp  
> "file:///my/progs/"
> 0x0000000055005800    73  fully_initialized     W        
> jdk.internal.event.ThreadSleepEvent
> 0x0000000055005400    73  allocated                      
> jdk.internal.event.ThreadSleepEvent
> ...
> 
> (Fixing a column width for the ClassName seems impossible as it can be really 
> long, so URL is simply printed after ClassName.)
> 
> 
> This is a continuation of https://git.openjdk.org/jdk/pull/29048 which was 
> pretty far along and this is a simple import.
> A few minor changes in help text, (C), and of course whitespace.
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Help text reads:


$  build/linux-x64/images/jdk/bin/jcmd  769483 help  VM.classes
769483:
VM.classes
Print all loaded classes.
Classes are annotated with flags:
 F = has, or inherits, a non-empty finalize method,
 f = has final method,
 W = methods rewritten,
 C = marked with @Contended annotation,
 R = has been redefined,
 S = is an (App)CDS shared class,
     (if -location is specified, append: 's' (static) or 'd' (dynamic) for AOT 
cache location)

Impact: Medium: Depends on number of loaded classes.

Syntax : VM.classes [options]

Options: (options must be specified using the <key> or <key>=<value> syntax)
        -verbose : [optional] Dump the detailed content of a Java class 
(BOOLEAN, false)
        -location : [optional] Print class file location URL (if available) 
(BOOLEAN, false)
$

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

PR Comment: https://git.openjdk.org/jdk/pull/31420#issuecomment-4650353003

Reply via email to