Summary
jcmd should output command list if no command is given.
Problem
When jcmd is invoked with valid target VM id(s) but without command, the generic help text is output:
./images/jdk/bin/jcmd org.eclipse.equinox.launcher Error parsing arguments: No command specified
Usage: jcmd
or: jcmd -l
or: jcmd -h
In order to get the list of commands, one has to retype the command, preceeding the command name with "help":
./images/jdk/bin/jcmd help org.eclipse.equinox.launcher
which involves moving the cursor back and loosing valuable seconds of your life.
Solution
When one or more VM ids are given, jcmd should connect to the VM(s) instead and print a list of available commands:
./images/jdk/bin/jcmd org.eclipse.equinox.launcher 8638: The following commands are available: VM.log VM.native_memory ManagementAgent.status ManagementAgent.stop ... VM.version help
Where multiple VMs are affected, I'd like all of them to print out command lists.
Specification
src/jdk.jcmd/share/classes/sun/tools/jcmd/Arguments.java:
@@ -86,11 +86,13 @@ sb.append(args[i]).append(" "); } }
if (listCounters != true && sb.length() == 0) {
- throw new IllegalArgumentException("No command specified"); + // Omitting the command shall cause the target VM to print out a list + // of available commands. + sb.append("help"); }
command = sb.toString().trim();
}
- csr of
-
JDK-8203014 jcmd should output command list if no command is given
-
- Resolved
-