< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jps/Arguments.java

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

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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

@@ -50,22 +50,26 @@
     private boolean mainArgs;
     private String hostname;
     private HostIdentifier hostId;
 
     public static void printUsage(PrintStream ps) {
-      ps.println("usage: jps [-help]");
+      ps.println("usage: jps [--help]");
       ps.println("       jps [-q] [-mlvV] [<hostid>]");
       ps.println();
       ps.println("Definitions:");
       ps.println("    <hostid>:      <hostname>[:<port>]");
+      ps.println("    -? -h --help -help: Print this help message and exit.");
     }
 
     public Arguments(String[] args) throws IllegalArgumentException {
         int argc = 0;
 
         if (args.length == 1) {
             if ((args[0].compareTo("-?") == 0)
+                || (args[0].compareTo("-h")== 0)
+                || (args[0].compareTo("--help")== 0)
+                // -help: legacy.
                     || (args[0].compareTo("-help")== 0)) {
               help = true;
               return;
             }
         }
< prev index next >