< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java

Print this page
rev 48074 : 8189102: All tools should support -?, -h and --help
Reviewed-by: kvn, jjg, weijun, alanb, rfield, ksrini

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -62,11 +62,15 @@
         while (optionCount < args.length) {
             String arg = args[optionCount];
             if (!arg.startsWith("-")) {
                 break;
             }
-            if (arg.equals("-help") || arg.equals("-h")) {
+            if (arg.equals("-?") ||
+                arg.equals("-h") ||
+                arg.equals("--help") ||
+                // -help: legacy. Undocumented.
+                arg.equals("-help")) {
                 usage(0);
             } else {
                 if (option != null) {
                     usage(1);  // option already specified
                 }

@@ -245,10 +249,12 @@
         System.err.println("    jmap -histo[:live] <pid>");
         System.err.println("        to connect to running process and print histogram of java object heap");
         System.err.println("        if the \"live\" suboption is specified, only count live objects");
         System.err.println("    jmap -dump:<dump-options> <pid>");
         System.err.println("        to connect to running process and dump java heap");
+        System.err.println("    jmap -? -h --help");
+        System.err.println("        to print this help message");
         System.err.println("");
         System.err.println("    dump-options:");
         System.err.println("      live         dump only live objects; if not specified,");
         System.err.println("                   all objects in the heap are dumped.");
         System.err.println("      format=b     binary format");
< prev index next >