RFR JDK-8170952: jar's usage message output need some cleanup

Xueming Shen xueming.shen at oracle.com
Fri Dec 9 00:13:10 UTC 2016


Please help some trival usage msg clean of the jar command

issue: https://bugs.openjdk.java.net/browse/JDK-8170952
webrev: http://cr.openjdk.java.net/~sherman/8170952/

  321     static void printUsageSummary(PrintWriter out) {
  322         out.format("%s%n", Main.getMsg("main.usage.summary"));
  323         out.format("%s%n", Main.getMsg("main.usage.summary.try"));
  324     }

with the original msgs in jar.properties as

  177 main.usage.summary=\
  178 jar: You must specify one of -ctxui options.
  179 main.usage.summary.try=\
  180 Try `jar --help' for more information.

So basic in most use cases, regardless the cause of the parsing err, we always have
the following two lines at the bottom of the jar brief usage msgs.

jar: You must specify one of -ctxui options.
Try `jar --help' for more information.

After talked with Chris, I suggested to simply remove the first line "jar: You mut
specify ...", IF there is already a error msg (for the real trigger) and the "try
jar --help...", for example

jar --list --create foo.jar now outputs

You may not specify more than one '-cuxti' options
Try `jar --help' for more information.

There is use scenario that there is no direct err msg, the general brief usage is
print out. For example, if you type "jar" without anything, then output is

Usage: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...
Try `jar --help' for more information.

which I think is more appropriate. I'm copy/pasting the "Usage: ..." from the
first line of  main.help.preopt. Hope it should be OK for the l10n team.


More information about the core-libs-dev mailing list