8213392: Enhance --help and --version JDK-8200758-branch
authorherrick
Wed, 12 Dec 2018 08:27:16 -0500
branchJDK-8200758-branch
changeset 57071 94e9270166f0
parent 57070 42783e8e73de
child 57072 29604aafa0fc
8213392: Enhance --help and --version Reviewed-by: almatvee, kcr
src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/CLIHelp.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties
src/jdk.jpackage/share/classes/jdk/jpackage/main/Main.java
test/jdk/tools/jpackage/JPackageNoArgTest.java
test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java	Tue Dec 11 12:54:18 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java	Wed Dec 12 08:27:16 2018 -0500
@@ -255,7 +255,7 @@
 
         LICENSE_FILE ("license-file", OptionCategories.PROPERTY),
 
-        VERSION ("version", "v", OptionCategories.PROPERTY),
+        VERSION ("app-version", OptionCategories.PROPERTY),
 
         JVM_ARGS ("jvm-args", OptionCategories.PROPERTY, () -> {
             List<String> args = getArgumentList(popArg());
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CLIHelp.java	Tue Dec 11 12:54:18 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CLIHelp.java	Wed Dec 12 08:27:16 2018 -0500
@@ -54,12 +54,24 @@
             switch (platform) {
                 case MAC:
                     Log.info(I18N.getString("MSG_Help_mac"));
+                    if (Log.isDebug()) {
+                        Log.info(I18N.getString("MSG_Help_win"));
+                        Log.info(I18N.getString("MSG_Help_linux"));
+                    }
                     break;
                 case LINUX:
-                     Log.info(I18N.getString("MSG_Help_linux"));
+                    Log.info(I18N.getString("MSG_Help_linux"));
+                    if (Log.isDebug()) {
+                        Log.info(I18N.getString("MSG_Help_win"));
+                        Log.info(I18N.getString("MSG_Help_mac"));
+                    }
                     break;
                 case WINDOWS:
-                     Log.info(I18N.getString("MSG_Help_win"));
+                    Log.info(I18N.getString("MSG_Help_win"));
+                    if (Log.isDebug()) {
+                        Log.info(I18N.getString("MSG_Help_mac"));
+                        Log.info(I18N.getString("MSG_Help_linux"));
+                    }
                     break;
             }
         }
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties	Tue Dec 11 12:54:18 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties	Wed Dec 12 08:27:16 2018 -0500
@@ -33,164 +33,189 @@
 \          Generates a platform-specific installer for the application.\n\
 \          Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg",\n\
 \                           "pkg", and "pkg-app-store".\n\
-\          If "type" is omitted, all supported types of installable packages\n\
-\          for current platform will be generated.\n\
+\          If "type" is omitted, all supported types of installable\n\
+\          packages for the current platform will be generated.\n\
 \  create-jre-installer <type>\n\
-\          Generates a platform-specific installer for Server JRE.\n\
+\          Generates a platform-specific installer for JRE.\n\
 \          Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg", \n\
 \                           and "pkg".\n\
-\          If "type" is omitted, all supported types of installable packages\n\
-\          for current platform will be generated.\n\
+\          If "type" is omitted, all supported types of installable\n\
+\          packages for the current platform will be generated.\n\
 \          \n\
 Sample usages:\n\
 --------------\n\
-jpackage create-image --input inputdir --output outputdir --name AppName --class package.ClassName --main-jar AppName.jar\n\
-or\n\
-jpackage create-image -o outputdir -n AppName -c package.ClassName -m moduleName -p modulePath\n\
-Generates an application image.\n\
-\n\
-jpackage create-installer -i inputdir -o outputdir -n "App Name" -c package.ClassName\n\
-Generates an application installer.\n\
-\n\
-jpackage create-jre-installer -n <jre_name> -o outputdir\n\
-Generates a Server JRE installer.\n\
+\    Generate an application image from a non-modular jar file:\n\
+\        jpackage create-image --input inputdir --output outputdir \\\n\
+\            --name AppName --class package.ClassName --main-jar MyJar.jar\n\
+\        jpackage create-image -i inputdir -o outputdir -n AppName \\\n\
+\            -c package.ClassName -j MyJar.jar\n\
+\    Generate an application image from a modular jar file:\n\
+\        jpackage create-image --output outputdir --name AppName \\\n\
+\            --class package.ClassName -module moduleName -p modulePath\n\
+\        jpackage create-image --o outputdir -n AppName \\\n\
+\            -c package.ClassName -m moduleName -p modulePath\n\
+\    Generate an application installer:\n\
+\        jpackage create-installer -i inputdir -o outputdir \\\n\
+\            -n "Installer Name" -c package.ClassName -j MyJar.jar\n\
+\        jpackage create-inataller -o outputdir -n "Installer Name" \\\n\
+              --app-image <app image dir>\n\
+\    Generate a JRE installer:\n\
+\        jpackage create-jre-installer -name <jre-name> -output outputdir\n\
+\        jpackage create-jre-installer -n <jre-name> -o outputdir \\\n\
+\             --runtime-image <path>\n\
 \n\
 The following options are valid for all platforms:\n\
 \  @<filename> \n\
-\          read options and mode from file. \n\
+\          Read options and/or mode from a file \n\
 \  --help -h \n\
-\          Shows the usage text, followed by a list and description of each valid option for the current platform and the given mode.\n\
-\          If no mode is given, shows the usage text, followed by a list and description of each valid option for the current platform.\n\
-\          When this option is used, all other options are ignored.\n\
+\          Print the usage text with a list and description of each valid\n\
+\          option for the current platform to the output stream, and exit\n\
+\  --version -v\n\
+\          Print the product version to the output stream and exit\n\
 \  --output -o <output dir>\n\
-\          Name of the directory where generated output file is placed.\n\
+\          Name of the directory where generated output file is placed\n\
 \  --input -i <input dir>\n\
-\          Name of the input directory that contains the files to package.\n\
+\          Name of the input directory that contains the files to package\n\
 \  --files -f <input files>\n\
-\          A {0} separated list of files in the input directory to be packaged.\n\
+\          A {0} separated list of files in the input dir to be packaged\n\
 \          If omitted, all files in the input directory will be packaged.\n\
 \  --name -n <application name>\n\
-\          Name of the application.\n\
+\          Name of the application\n\
 \  --main-jar -j <main jar name>\n\
-\          The main JAR of the application. This JAR should have the main-class,\n\
-\          and is relative to the assembled application directory.\n\
+\          The main JAR of the application\n\
+\          This JAR should have the main-class, and is relative\n\
+\          to the assembled application directory.\n\
 \  --class -c <class name>\n\
-\          Qualified name of the application class to execute.\n\
-\  --version -v <version string>\n\
-\          Version of the application.\n\
+\          Qualified name of the application class to execute\n\
+\  --app-version <version string>\n\
+\          Version of the application\n\
 \  --arguments -a <main class arguments>\n\
-\          Command line arguments to pass to the main class if no arguments\n\
-\          are specified by the launcher.\n\
+\          Command line arguments to pass to the main class if no\n\
+\          arguments are specified by the launcher\n\
 \  --icon <icon file name>\n\
-\          Icon of the application bundle.\n\
+\          Icon of the application bundle\n\
 \  --singleton\n\
 \          Prevents multiple instances of the application from launching\n\
-\          (see SingleInstanceService API for more details).\n\
+\          (see SingleInstanceService API for more details)\n\
 \  --identifier <id string>\n\
-\          Machine readable identifier of the application. The format\n\
-\          must be a DNS name in reverse order, such as com.example.myapplication.\n\
+\          Machine readable identifier of the application\n\
+\          The format must be a DNS name in reverse order,\n\
+\          such as com.example.myapplication.\n\
 \  --verbose\n\
-\          Enables verbose output.\n\
+\          Enables verbose output\n\
 \  --strip-native-commands\n\
-\          Removes native executables from the custom run-time images.\n\
+\          Removes native executables from the custom run-time images\n\
 \  --jvm-args <java vm arguments>\n\
-\          JVM flags and options to pass to the application.\n\
+\          JVM flags and options to pass to the application\n\
 \  --file-associations <file path>\n\
-\          Properties file that contains list of key=value parameters that\n\
-\          describe a file association. "extension", "mime-type", "icon",\n\
-\          "description" can be used as keys for the association.\n\
+\          Properties file that contains list of key,value pairs that\n\
+\          describe a file association\n\
+\          "extension", "mime-type", "icon", and "description"\n\
+\          can be used as keys for the association.\n\
 \  --secondary-launcher <file path>\n\
-\          Properties file that contains a collection of options for a secondary launcher.\n\
+\          Properties file that contains a collection of options\n\
+\          for a secondary launcher\n\
 \  --build-root <file path>\n\
-\          Directory in which to use and place temporary files.\n\
+\          Directory in which to use and place temporary files\n\
 \  --runtime-image <file path>\n\
 \          Location of the predefined runtime image that is used to build\n\
-\          an application image and installable package.\n\
+\          an application image and installable package\n\
 \  --app-image <file path>\n\
-\          Location of the predefined application image that is used to build\n\
-\          an installable package.\n\
+\          Location of the predefined application image that is used\n\
+\          to build an installable package\n\
 \  --install-dir <file path>\n\
-\          Installation directory of the application. Ignored on Windows, use\n\
-\          --win-dir-chooser to provide an ability to choose an installation directory.\n\
+\          Installation directory of the application\n\
+\          This option is ignored on Windows, use --win-dir-chooser to\n\
+\          provide user the ability to choose the installation directory.\n\
 \  --license-file <file name>\n\
-\          The license file, relative to the input directory.\n\
+\          The license file, relative to the input directory\n\
 \  --copyright <copyright string>\n\
-\          Copyright for the application.\n\
+\          Copyright for the application\n\
 \  --description <description string>\n\
-\          Description of the application.\n\
+\          Description of the application\n\
 \  --category <category string>\n\
-\          Category or group of the application.\n\
+\          Category or group of the application\n\
 \  --vendor <vendor string>\n\
-\          Vendor of the application.\n\
-\  --force -- Allow the deletion of any existing output root directory when creating an Application image.\n\
+\          Vendor of the application\n\
+\  --force Allow the deletion of any existing output root directory\n\
+\          when creating an Application image\n\
 \n\
 Modular options:\n\
 \  --module -m <module name>\n\
-\          Main module of the application. This module must have the main-class,\n\
-\          and be on the module path.\n\
+\          Main module of the application\n\
+\          This module must contain the main-class,\n\
+\          and be located on the module path.\n\
 \  --module-path -p <module path>\n\
-\          When packaging the Java Runtime, this is the path JLink looks in for modules.\n\
+\          Path JLink looks in for modules when packaging the Java Runtime\n\
 \  --add-modules <module list>\n\
 \          A {0} separated list of modules to add to JImage creation,\n\
-\          including possible services.\n\
+\          including possible services\n\
 \  --limit-modules <module list>\n\
-\          A {0} separated list of Modules to limit JImage creation to.\n\
+\          A {0} separated list of Modules to limit JImage creation to\n\
 
 MSG_Help_mac=\nThe following options are valid for Mac OS X platforms:\n\
 \  --mac-sign\n\
-\          Request that the bundle be signed.\n\
+\          Request that the bundle be signed\n\
 \  --mac-bundle-name <name string>\n\
-\          Name of the application as it appears in the Menu Bar. This can be\n\
-\          different from the application name. This name must be less than 16\n\
-\          characters long and be suitable for displaying in the menu bar and\n\
-\          the application Info window. Defaults to the application name.\n\
+\          Name of the application as it appears in the Menu Bar\n\
+\          This can be different from the application name.\n\
+\          This name must be less than 16 characters long and be suitable for\n\
+\          displaying in the menu bar and the application Info window.\n\
+\          Defaults to the application name.\n\
 \  --mac-bundle-identifier <ID string>\n\
 \          An identifier that uniquely identifies the application for MacOSX\n\
-\          (and on the Mac App Store).  May only use alphanumeric (A-Z,a-z,0-9),\n\
-\          hyphen (-), and period (.) characters.\n\
+\          (and on the Mac App Store)\n\
+\          May only use alphanumeric (A-Z,a-z,0-9), hyphen (-),\n\
+\          and period (.) characters.\n\
 \  --mac-app-store-category <category string>\n\
-\          Mac App Store Categories. Note that the key is the string shown to\n\
+\          Mac App Store Categories\n\
+\          Note that the key is the string shown to\n\
 \          the user and the value is the ID of the category.\n\
 \  --mac-app-store-entitlements <file path>\n\
-\          File location of a custom mac app store entitlements file.\n\
+\          File location of a custom mac app store entitlements file\n\
 \  --mac-bundle-signing-prefix <prefix string>\n\
 \          When signing the application bundle, this value is prefixed to all\n\
-\          components that need to be signed that don't have an existing bundle identifier.\n\
+\          components that need to be signed that don't have\n\
+\          an existing bundle identifier.\n\
 \  --mac-signing-key-user-name <user name>\n\
-\          User name portion of the typical "Mac Developer ID Application: <user name>" signing key.\n\
+\          User name portion of the typical\n\
+\          "Mac Developer ID Application: <user name>" signing key\n\
 \  --mac-signing-keychain <file path>\n\
-\          Location of the keychain to use. If not specified, the standard keychains are used.\n\
+\          Location of the keychain to use\n\
+\          If not specified, the standard keychains are used.\n\
 
 MSG_Help_linux=\nThe following options are valid for Linux platforms:\n\
 \  --linux-bundle-name <bundle name>\n\
-\          Name for Linux bundle. Defaults to the application name.\n\
+\          Name for Linux bundle, defaults to the application name\n\
 \  --linux-package-deps\n\
-\          Required packages or capabilities for the application.\n\
+\          Required packages or capabilities for the application\n\
 \  --linux-rpm-license-type <type string>\n\
-\          Type of the license ("License: <value>" of the RPM .spec).\n\
+\          Type of the license ("License: <value>" of the RPM .spec)\n\
 \  --linux-deb-maintainer <email address>\n\
-\          Maintainer for .deb bundle.\n\
+\          Maintainer for .deb bundle\n\
 
 MSG_Help_win=\nThe following options are valid for Windows platforms:\n\
 \  --win-menu\n\
-\          Adds the application to the system menu.\n\
+\          Adds the application to the system menu\n\
 \  --win-menu-group <menu group name>\n\
-\          Start Menu group this application is placed in.\n\
+\          Start Menu group this application is placed in\n\
 \  --win-per-user-install\n\
-\          Request to perform an install on a per-user basis.\n\
+\          Request to perform an install on a per-user basis\n\
 \  --win-dir-chooser\n\
 \          Adds a dialog to enable the user to choose a directory in which\n\
-\          the product is installed.\n\
+\          the product is installed\n\
 \  --win-registry-name <registry name>\n\
-\          Name of the application for registry references. Default is\n\
-\          the Application Name with only alphanumerics, dots, and dashes (no whitespace).\n\
+\          Name of the application for registry references.\n\
+\          The default is the Application Name with only\n\
+\          alphanumerics, dots, and dashes (no whitespace)\n\
 \  --win-upgrade-uuid <id string>\n\
-\          UUID associated with upgrades for this package.\n\
+\          UUID associated with upgrades for this package\n\
 \  --win-shortcut\n\
-\          Creates a desktop shortcut for the application.\n\
+\          Creates a desktop shortcut for the application\n\
 \  --win-console\n\
-\          Creates a console launcher for the application. Should be specified for\n\
-\          application which requires console interactions.\n\
+\          Creates a console launcher for the application, should be\n\
+\          specified for application which requires console interactions\n\
 
 MSG_Help_no_args=Usage: jpackage <mode> <options>\n\
-\Use --help for a list of possible options\
+\Use jpackage --help (or -h) for a list of possible options\
+
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties	Tue Dec 11 12:54:18 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties	Wed Dec 12 08:27:16 2018 -0500
@@ -33,164 +33,189 @@
 \          Generates a platform-specific installer for the application.\n\
 \          Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg",\n\
 \                           "pkg", and "pkg-app-store".\n\
-\          If "type" is omitted, all supported types of installable packages\n\
-\          for current platform will be generated.\n\
+\          If "type" is omitted, all supported types of installable\n\
+\          packages for the current platform will be generated.\n\
 \  create-jre-installer <type>\n\
-\          Generates a platform-specific installer for Server JRE.\n\
+\          Generates a platform-specific installer for JRE.\n\
 \          Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg", \n\
 \                           and "pkg".\n\
-\          If "type" is omitted, all supported types of installable packages\n\
-\          for current platform will be generated.\n\
+\          If "type" is omitted, all supported types of installable\n\
+\          packages for the current platform will be generated.\n\
 \          \n\
 Sample usages:\n\
 --------------\n\
-jpackage create-image --input inputdir --output outputdir --name AppName --class package.ClassName --main-jar AppName.jar\n\
-or\n\
-jpackage create-image -o outputdir -n AppName -c package.ClassName -m moduleName -p modulePath\n\
-Generates an application image.\n\
-\n\
-jpackage create-installer -i inputdir -o outputdir -n "App Name" -c package.ClassName\n\
-Generates an application installer.\n\
-\n\
-jpackage create-jre-installer -n <jre_name> -o outputdir\n\
-Generates a Server JRE installer.\n\
+\    Generate an application image from a non-modular jar file:\n\
+\        jpackage create-image --input inputdir --output outputdir \\\n\
+\            --name AppName --class package.ClassName --main-jar MyJar.jar\n\
+\        jpackage create-image -i inputdir -o outputdir -n AppName \\\n\
+\            -c package.ClassName -j MyJar.jar\n\
+\    Generate an application image from a modular jar file:\n\
+\        jpackage create-image --output outputdir --name AppName \\\n\
+\            --class package.ClassName -module moduleName -p modulePath\n\
+\        jpackage create-image --o outputdir -n AppName \\\n\
+\            -c package.ClassName -m moduleName -p modulePath\n\
+\    Generate an application installer:\n\
+\        jpackage create-installer -i inputdir -o outputdir \\\n\
+\            -n "Installer Name" -c package.ClassName -j MyJar.jar\n\
+\        jpackage create-inataller -o outputdir -n "Installer Name" \\\n\
+              --app-image <app image dir>\n\
+\    Generate a JRE installer:\n\
+\        jpackage create-jre-installer -name <jre-name> -output outputdir\n\
+\        jpackage create-jre-installer -n <jre-name> -o outputdir \\\n\
+\             --runtime-image <path>\n\
 \n\
 The following options are valid for all platforms:\n\
 \  @<filename> \n\
-\          read options and mode from file. \n\
+\          Read options and/or mode from a file \n\
 \  --help -h \n\
-\          Shows the usage text, followed by a list and description of each valid option for the current platform and the given mode.\n\
-\          If no mode is given, shows the usage text, followed by a list and description of each valid option for the current platform.\n\
-\          When this option is used, all other options are ignored.\n\
+\          Print the usage text with a list and description of each valid\n\
+\          option for the current platform to the output stream, and exit\n\
+\  --version -v\n\
+\          Print the product version to the output stream and exit\n\
 \  --output -o <output dir>\n\
-\          Name of the directory where generated output file is placed.\n\
+\          Name of the directory where generated output file is placed\n\
 \  --input -i <input dir>\n\
-\          Name of the input directory that contains the files to package.\n\
+\          Name of the input directory that contains the files to package\n\
 \  --files -f <input files>\n\
-\          A {0} separated list of files in the input directory to be packaged.\n\
+\          A {0} separated list of files in the input dir to be packaged\n\
 \          If omitted, all files in the input directory will be packaged.\n\
 \  --name -n <application name>\n\
-\          Name of the application.\n\
+\          Name of the application\n\
 \  --main-jar -j <main jar name>\n\
-\          The main JAR of the application. This JAR should have the main-class,\n\
-\          and is relative to the assembled application directory.\n\
+\          The main JAR of the application\n\
+\          This JAR should have the main-class, and is relative\n\
+\          to the assembled application directory.\n\
 \  --class -c <class name>\n\
-\          Qualified name of the application class to execute.\n\
-\  --version -v <version string>\n\
-\          Version of the application.\n\
+\          Qualified name of the application class to execute\n\
+\  --app-version <version string>\n\
+\          Version of the application\n\
 \  --arguments -a <main class arguments>\n\
-\          Command line arguments to pass to the main class if no arguments\n\
-\          are specified by the launcher.\n\
+\          Command line arguments to pass to the main class if no\n\
+\          arguments are specified by the launcher\n\
 \  --icon <icon file name>\n\
-\          Icon of the application bundle.\n\
+\          Icon of the application bundle\n\
 \  --singleton\n\
 \          Prevents multiple instances of the application from launching\n\
-\          (see SingleInstanceService API for more details).\n\
+\          (see SingleInstanceService API for more details)\n\
 \  --identifier <id string>\n\
-\          Machine readable identifier of the application. The format\n\
-\          must be a DNS name in reverse order, such as com.example.myapplication.\n\
+\          Machine readable identifier of the application\n\
+\          The format must be a DNS name in reverse order,\n\
+\          such as com.example.myapplication.\n\
 \  --verbose\n\
-\          Enables verbose output.\n\
+\          Enables verbose output\n\
 \  --strip-native-commands\n\
-\          Removes native executables from the custom run-time images.\n\
+\          Removes native executables from the custom run-time images\n\
 \  --jvm-args <java vm arguments>\n\
-\          JVM flags and options to pass to the application.\n\
+\          JVM flags and options to pass to the application\n\
 \  --file-associations <file path>\n\
-\          Properties file that contains list of key=value parameters that\n\
-\          describe a file association. "extension", "mime-type", "icon",\n\
-\          "description" can be used as keys for the association.\n\
+\          Properties file that contains list of key,value pairs that\n\
+\          describe a file association\n\
+\          "extension", "mime-type", "icon", and "description"\n\
+\          can be used as keys for the association.\n\
 \  --secondary-launcher <file path>\n\
-\          Properties file that contains a collection of options for a secondary launcher.\n\
+\          Properties file that contains a collection of options\n\
+\          for a secondary launcher\n\
 \  --build-root <file path>\n\
-\          Directory in which to use and place temporary files.\n\
+\          Directory in which to use and place temporary files\n\
 \  --runtime-image <file path>\n\
 \          Location of the predefined runtime image that is used to build\n\
-\          an application image and installable package.\n\
+\          an application image and installable package\n\
 \  --app-image <file path>\n\
-\          Location of the predefined application image that is used to build\n\
-\          an installable package.\n\
+\          Location of the predefined application image that is used\n\
+\          to build an installable package\n\
 \  --install-dir <file path>\n\
-\          Installation directory of the application. Ignored on Windows, use\n\
-\          --win-dir-chooser to provide an ability to choose an installation directory.\n\
+\          Installation directory of the application\n\
+\          This option is ignored on Windows, use --win-dir-chooser to\n\
+\          provide user the ability to choose the installation directory.\n\
 \  --license-file <file name>\n\
-\          The license file, relative to the input directory.\n\
+\          The license file, relative to the input directory\n\
 \  --copyright <copyright string>\n\
-\          Copyright for the application.\n\
+\          Copyright for the application\n\
 \  --description <description string>\n\
-\          Description of the application.\n\
+\          Description of the application\n\
 \  --category <category string>\n\
-\          Category or group of the application.\n\
+\          Category or group of the application\n\
 \  --vendor <vendor string>\n\
-\          Vendor of the application.\n\
-\  --force -- Allow the deletion of any existing output root directory when creating an Application image.\n\
+\          Vendor of the application\n\
+\  --force Allow the deletion of any existing output root directory\n\
+\          when creating an Application image\n\
 \n\
 Modular options:\n\
 \  --module -m <module name>\n\
-\          Main module of the application. This module must have the main-class,\n\
-\          and be on the module path.\n\
+\          Main module of the application\n\
+\          This module must contain the main-class,\n\
+\          and be located on the module path.\n\
 \  --module-path -p <module path>\n\
-\          When packaging the Java Runtime, this is the path JLink looks in for modules.\n\
+\          Path JLink looks in for modules when packaging the Java Runtime\n\
 \  --add-modules <module list>\n\
 \          A {0} separated list of modules to add to JImage creation,\n\
-\          including possible services.\n\
+\          including possible services\n\
 \  --limit-modules <module list>\n\
-\          A {0} separated list of Modules to limit JImage creation to.\n\
+\          A {0} separated list of Modules to limit JImage creation to\n\
 
 MSG_Help_mac=\nThe following options are valid for Mac OS X platforms:\n\
 \  --mac-sign\n\
-\          Request that the bundle be signed.\n\
+\          Request that the bundle be signed\n\
 \  --mac-bundle-name <name string>\n\
-\          Name of the application as it appears in the Menu Bar. This can be\n\
-\          different from the application name. This name must be less than 16\n\
-\          characters long and be suitable for displaying in the menu bar and\n\
-\          the application Info window. Defaults to the application name.\n\
+\          Name of the application as it appears in the Menu Bar\n\
+\          This can be different from the application name.\n\
+\          This name must be less than 16 characters long and be suitable for\n\
+\          displaying in the menu bar and the application Info window.\n\
+\          Defaults to the application name.\n\
 \  --mac-bundle-identifier <ID string>\n\
 \          An identifier that uniquely identifies the application for MacOSX\n\
-\          (and on the Mac App Store).  May only use alphanumeric (A-Z,a-z,0-9),\n\
-\          hyphen (-), and period (.) characters.\n\
+\          (and on the Mac App Store)\n\
+\          May only use alphanumeric (A-Z,a-z,0-9), hyphen (-),\n\
+\          and period (.) characters.\n\
 \  --mac-app-store-category <category string>\n\
-\          Mac App Store Categories. Note that the key is the string shown to\n\
+\          Mac App Store Categories\n\
+\          Note that the key is the string shown to\n\
 \          the user and the value is the ID of the category.\n\
 \  --mac-app-store-entitlements <file path>\n\
-\          File location of a custom mac app store entitlements file.\n\
+\          File location of a custom mac app store entitlements file\n\
 \  --mac-bundle-signing-prefix <prefix string>\n\
 \          When signing the application bundle, this value is prefixed to all\n\
-\          components that need to be signed that don't have an existing bundle identifier.\n\
+\          components that need to be signed that don't have\n\
+\          an existing bundle identifier.\n\
 \  --mac-signing-key-user-name <user name>\n\
-\          User name portion of the typical "Mac Developer ID Application: <user name>" signing key.\n\
+\          User name portion of the typical\n\
+\          "Mac Developer ID Application: <user name>" signing key\n\
 \  --mac-signing-keychain <file path>\n\
-\          Location of the keychain to use. If not specified, the standard keychains are used.\n\
+\          Location of the keychain to use\n\
+\          If not specified, the standard keychains are used.\n\
 
 MSG_Help_linux=\nThe following options are valid for Linux platforms:\n\
 \  --linux-bundle-name <bundle name>\n\
-\          Name for Linux bundle. Defaults to the application name.\n\
+\          Name for Linux bundle, defaults to the application name\n\
 \  --linux-package-deps\n\
-\          Required packages or capabilities for the application.\n\
+\          Required packages or capabilities for the application\n\
 \  --linux-rpm-license-type <type string>\n\
-\          Type of the license ("License: <value>" of the RPM .spec).\n\
+\          Type of the license ("License: <value>" of the RPM .spec)\n\
 \  --linux-deb-maintainer <email address>\n\
-\          Maintainer for .deb bundle.\n\
+\          Maintainer for .deb bundle\n\
 
 MSG_Help_win=\nThe following options are valid for Windows platforms:\n\
 \  --win-menu\n\
-\          Adds the application to the system menu.\n\
+\          Adds the application to the system menu\n\
 \  --win-menu-group <menu group name>\n\
-\          Start Menu group this application is placed in.\n\
+\          Start Menu group this application is placed in\n\
 \  --win-per-user-install\n\
-\          Request to perform an install on a per-user basis.\n\
+\          Request to perform an install on a per-user basis\n\
 \  --win-dir-chooser\n\
 \          Adds a dialog to enable the user to choose a directory in which\n\
-\          the product is installed.\n\
+\          the product is installed\n\
 \  --win-registry-name <registry name>\n\
-\          Name of the application for registry references. Default is\n\
-\          the Application Name with only alphanumerics, dots, and dashes (no whitespace).\n\
+\          Name of the application for registry references.\n\
+\          The default is the Application Name with only\n\
+\          alphanumerics, dots, and dashes (no whitespace)\n\
 \  --win-upgrade-uuid <id string>\n\
-\          UUID associated with upgrades for this package.\n\
+\          UUID associated with upgrades for this package\n\
 \  --win-shortcut\n\
-\          Creates a desktop shortcut for the application.\n\
+\          Creates a desktop shortcut for the application\n\
 \  --win-console\n\
-\          Creates a console launcher for the application. Should be specified for\n\
-\          application which requires console interactions.\n\
+\          Creates a console launcher for the application, should be\n\
+\          specified for application which requires console interactions\n\
 
 MSG_Help_no_args=Usage: jpackage <mode> <options>\n\
-\Use --help for a list of possible options\
+\Use jpackage --help (or -h) for a list of possible options\
+
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties	Tue Dec 11 12:54:18 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties	Wed Dec 12 08:27:16 2018 -0500
@@ -33,164 +33,189 @@
 \          Generates a platform-specific installer for the application.\n\
 \          Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg",\n\
 \                           "pkg", and "pkg-app-store".\n\
-\          If "type" is omitted, all supported types of installable packages\n\
-\          for current platform will be generated.\n\
+\          If "type" is omitted, all supported types of installable\n\
+\          packages for the current platform will be generated.\n\
 \  create-jre-installer <type>\n\
-\          Generates a platform-specific installer for Server JRE.\n\
+\          Generates a platform-specific installer for JRE.\n\
 \          Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg", \n\
 \                           and "pkg".\n\
-\          If "type" is omitted, all supported types of installable packages\n\
-\          for current platform will be generated.\n\
+\          If "type" is omitted, all supported types of installable\n\
+\          packages for the current platform will be generated.\n\
 \          \n\
 Sample usages:\n\
 --------------\n\
-jpackage create-image --input inputdir --output outputdir --name AppName --class package.ClassName --main-jar AppName.jar\n\
-or\n\
-jpackage create-image -o outputdir -n AppName -c package.ClassName -m moduleName -p modulePath\n\
-Generates an application image.\n\
-\n\
-jpackage create-installer -i inputdir -o outputdir -n "App Name" -c package.ClassName\n\
-Generates an application installer.\n\
-\n\
-jpackage create-jre-installer -n <jre_name> -o outputdir\n\
-Generates a Server JRE installer.\n\
+\    Generate an application image from a non-modular jar file:\n\
+\        jpackage create-image --input inputdir --output outputdir \\\n\
+\            --name AppName --class package.ClassName --main-jar MyJar.jar\n\
+\        jpackage create-image -i inputdir -o outputdir -n AppName \\\n\
+\            -c package.ClassName -j MyJar.jar\n\
+\    Generate an application image from a modular jar file:\n\
+\        jpackage create-image --output outputdir --name AppName \\\n\
+\            --class package.ClassName -module moduleName -p modulePath\n\
+\        jpackage create-image --o outputdir -n AppName \\\n\
+\            -c package.ClassName -m moduleName -p modulePath\n\
+\    Generate an application installer:\n\
+\        jpackage create-installer -i inputdir -o outputdir \\\n\
+\            -n "Installer Name" -c package.ClassName -j MyJar.jar\n\
+\        jpackage create-inataller -o outputdir -n "Installer Name" \\\n\
+              --app-image <app image dir>\n\
+\    Generate a JRE installer:\n\
+\        jpackage create-jre-installer -name <jre-name> -output outputdir\n\
+\        jpackage create-jre-installer -n <jre-name> -o outputdir \\\n\
+\             --runtime-image <path>\n\
 \n\
 The following options are valid for all platforms:\n\
 \  @<filename> \n\
-\          read options and mode from file. \n\
+\          Read options and/or mode from a file \n\
 \  --help -h \n\
-\          Shows the usage text, followed by a list and description of each valid option for the current platform and the given mode.\n\
-\          If no mode is given, shows the usage text, followed by a list and description of each valid option for the current platform.\n\
-\          When this option is used, all other options are ignored.\n\
+\          Print the usage text with a list and description of each valid\n\
+\          option for the current platform to the output stream, and exit\n\
+\  --version -v\n\
+\          Print the product version to the output stream and exit\n\
 \  --output -o <output dir>\n\
-\          Name of the directory where generated output file is placed.\n\
+\          Name of the directory where generated output file is placed\n\
 \  --input -i <input dir>\n\
-\          Name of the input directory that contains the files to package.\n\
+\          Name of the input directory that contains the files to package\n\
 \  --files -f <input files>\n\
-\          A {0} separated list of files in the input directory to be packaged.\n\
+\          A {0} separated list of files in the input dir to be packaged\n\
 \          If omitted, all files in the input directory will be packaged.\n\
 \  --name -n <application name>\n\
-\          Name of the application.\n\
+\          Name of the application\n\
 \  --main-jar -j <main jar name>\n\
-\          The main JAR of the application. This JAR should have the main-class,\n\
-\          and is relative to the assembled application directory.\n\
+\          The main JAR of the application\n\
+\          This JAR should have the main-class, and is relative\n\
+\          to the assembled application directory.\n\
 \  --class -c <class name>\n\
-\          Qualified name of the application class to execute.\n\
-\  --version -v <version string>\n\
-\          Version of the application.\n\
+\          Qualified name of the application class to execute\n\
+\  --app-version <version string>\n\
+\          Version of the application\n\
 \  --arguments -a <main class arguments>\n\
-\          Command line arguments to pass to the main class if no arguments\n\
-\          are specified by the launcher.\n\
+\          Command line arguments to pass to the main class if no\n\
+\          arguments are specified by the launcher\n\
 \  --icon <icon file name>\n\
-\          Icon of the application bundle.\n\
+\          Icon of the application bundle\n\
 \  --singleton\n\
 \          Prevents multiple instances of the application from launching\n\
-\          (see SingleInstanceService API for more details).\n\
+\          (see SingleInstanceService API for more details)\n\
 \  --identifier <id string>\n\
-\          Machine readable identifier of the application. The format\n\
-\          must be a DNS name in reverse order, such as com.example.myapplication.\n\
+\          Machine readable identifier of the application\n\
+\          The format must be a DNS name in reverse order,\n\
+\          such as com.example.myapplication.\n\
 \  --verbose\n\
-\          Enables verbose output.\n\
+\          Enables verbose output\n\
 \  --strip-native-commands\n\
-\          Removes native executables from the custom run-time images.\n\
+\          Removes native executables from the custom run-time images\n\
 \  --jvm-args <java vm arguments>\n\
-\          JVM flags and options to pass to the application.\n\
+\          JVM flags and options to pass to the application\n\
 \  --file-associations <file path>\n\
-\          Properties file that contains list of key=value parameters that\n\
-\          describe a file association. "extension", "mime-type", "icon",\n\
-\          "description" can be used as keys for the association.\n\
+\          Properties file that contains list of key,value pairs that\n\
+\          describe a file association\n\
+\          "extension", "mime-type", "icon", and "description"\n\
+\          can be used as keys for the association.\n\
 \  --secondary-launcher <file path>\n\
-\          Properties file that contains a collection of options for a secondary launcher.\n\
+\          Properties file that contains a collection of options\n\
+\          for a secondary launcher\n\
 \  --build-root <file path>\n\
-\          Directory in which to use and place temporary files.\n\
+\          Directory in which to use and place temporary files\n\
 \  --runtime-image <file path>\n\
 \          Location of the predefined runtime image that is used to build\n\
-\          an application image and installable package.\n\
+\          an application image and installable package\n\
 \  --app-image <file path>\n\
-\          Location of the predefined application image that is used to build\n\
-\          an installable package.\n\
+\          Location of the predefined application image that is used\n\
+\          to build an installable package\n\
 \  --install-dir <file path>\n\
-\          Installation directory of the application. Ignored on Windows, use\n\
-\          --win-dir-chooser to provide an ability to choose an installation directory.\n\
+\          Installation directory of the application\n\
+\          This option is ignored on Windows, use --win-dir-chooser to\n\
+\          provide user the ability to choose the installation directory.\n\
 \  --license-file <file name>\n\
-\          The license file, relative to the input directory.\n\
+\          The license file, relative to the input directory\n\
 \  --copyright <copyright string>\n\
-\          Copyright for the application.\n\
+\          Copyright for the application\n\
 \  --description <description string>\n\
-\          Description of the application.\n\
+\          Description of the application\n\
 \  --category <category string>\n\
-\          Category or group of the application.\n\
+\          Category or group of the application\n\
 \  --vendor <vendor string>\n\
-\          Vendor of the application.\n\
-\  --force -- Allow the deletion of any existing output root directory when creating an Application image.\n\
+\          Vendor of the application\n\
+\  --force Allow the deletion of any existing output root directory\n\
+\          when creating an Application image\n\
 \n\
 Modular options:\n\
 \  --module -m <module name>\n\
-\          Main module of the application. This module must have the main-class,\n\
-\          and be on the module path.\n\
+\          Main module of the application\n\
+\          This module must contain the main-class,\n\
+\          and be located on the module path.\n\
 \  --module-path -p <module path>\n\
-\          When packaging the Java Runtime, this is the path JLink looks in for modules.\n\
+\          Path JLink looks in for modules when packaging the Java Runtime\n\
 \  --add-modules <module list>\n\
 \          A {0} separated list of modules to add to JImage creation,\n\
-\          including possible services.\n\
+\          including possible services\n\
 \  --limit-modules <module list>\n\
-\          A {0} separated list of Modules to limit JImage creation to.\n\
+\          A {0} separated list of Modules to limit JImage creation to\n\
 
 MSG_Help_mac=\nThe following options are valid for Mac OS X platforms:\n\
 \  --mac-sign\n\
-\          Request that the bundle be signed.\n\
+\          Request that the bundle be signed\n\
 \  --mac-bundle-name <name string>\n\
-\          Name of the application as it appears in the Menu Bar. This can be\n\
-\          different from the application name. This name must be less than 16\n\
-\          characters long and be suitable for displaying in the menu bar and\n\
-\          the application Info window. Defaults to the application name.\n\
+\          Name of the application as it appears in the Menu Bar\n\
+\          This can be different from the application name.\n\
+\          This name must be less than 16 characters long and be suitable for\n\
+\          displaying in the menu bar and the application Info window.\n\
+\          Defaults to the application name.\n\
 \  --mac-bundle-identifier <ID string>\n\
 \          An identifier that uniquely identifies the application for MacOSX\n\
-\          (and on the Mac App Store).  May only use alphanumeric (A-Z,a-z,0-9),\n\
-\          hyphen (-), and period (.) characters.\n\
+\          (and on the Mac App Store)\n\
+\          May only use alphanumeric (A-Z,a-z,0-9), hyphen (-),\n\
+\          and period (.) characters.\n\
 \  --mac-app-store-category <category string>\n\
-\          Mac App Store Categories. Note that the key is the string shown to\n\
+\          Mac App Store Categories\n\
+\          Note that the key is the string shown to\n\
 \          the user and the value is the ID of the category.\n\
 \  --mac-app-store-entitlements <file path>\n\
-\          File location of a custom mac app store entitlements file.\n\
+\          File location of a custom mac app store entitlements file\n\
 \  --mac-bundle-signing-prefix <prefix string>\n\
 \          When signing the application bundle, this value is prefixed to all\n\
-\          components that need to be signed that don't have an existing bundle identifier.\n\
+\          components that need to be signed that don't have\n\
+\          an existing bundle identifier.\n\
 \  --mac-signing-key-user-name <user name>\n\
-\          User name portion of the typical "Mac Developer ID Application: <user name>" signing key.\n\
+\          User name portion of the typical\n\
+\          "Mac Developer ID Application: <user name>" signing key\n\
 \  --mac-signing-keychain <file path>\n\
-\          Location of the keychain to use. If not specified, the standard keychains are used.\n\
+\          Location of the keychain to use\n\
+\          If not specified, the standard keychains are used.\n\
 
 MSG_Help_linux=\nThe following options are valid for Linux platforms:\n\
 \  --linux-bundle-name <bundle name>\n\
-\          Name for Linux bundle. Defaults to the application name.\n\
+\          Name for Linux bundle, defaults to the application name\n\
 \  --linux-package-deps\n\
-\          Required packages or capabilities for the application.\n\
+\          Required packages or capabilities for the application\n\
 \  --linux-rpm-license-type <type string>\n\
-\          Type of the license ("License: <value>" of the RPM .spec).\n\
+\          Type of the license ("License: <value>" of the RPM .spec)\n\
 \  --linux-deb-maintainer <email address>\n\
-\          Maintainer for .deb bundle.\n\
+\          Maintainer for .deb bundle\n\
 
 MSG_Help_win=\nThe following options are valid for Windows platforms:\n\
 \  --win-menu\n\
-\          Adds the application to the system menu.\n\
+\          Adds the application to the system menu\n\
 \  --win-menu-group <menu group name>\n\
-\          Start Menu group this application is placed in.\n\
+\          Start Menu group this application is placed in\n\
 \  --win-per-user-install\n\
-\          Request to perform an install on a per-user basis.\n\
+\          Request to perform an install on a per-user basis\n\
 \  --win-dir-chooser\n\
 \          Adds a dialog to enable the user to choose a directory in which\n\
-\          the product is installed.\n\
+\          the product is installed\n\
 \  --win-registry-name <registry name>\n\
-\          Name of the application for registry references. Default is\n\
-\          the Application Name with only alphanumerics, dots, and dashes (no whitespace).\n\
+\          Name of the application for registry references.\n\
+\          The default is the Application Name with only\n\
+\          alphanumerics, dots, and dashes (no whitespace)\n\
 \  --win-upgrade-uuid <id string>\n\
-\          UUID associated with upgrades for this package.\n\
+\          UUID associated with upgrades for this package\n\
 \  --win-shortcut\n\
-\          Creates a desktop shortcut for the application.\n\
+\          Creates a desktop shortcut for the application\n\
 \  --win-console\n\
-\          Creates a console launcher for the application. Should be specified for\n\
-\          application which requires console interactions.\n\
+\          Creates a console launcher for the application, should be\n\
+\          specified for application which requires console interactions\n\
 
 MSG_Help_no_args=Usage: jpackage <mode> <options>\n\
-\Use --help for a list of possible options\
+\Use jpackage --help (or -h) for a list of possible options\
+
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/main/Main.java	Tue Dec 11 12:54:18 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/main/Main.java	Wed Dec 12 08:27:16 2018 -0500
@@ -78,14 +78,17 @@
         if (args.length == 0) {
             CLIHelp.showHelp(true);
         } else if (hasHelp(args)){
+            if (hasVersion(args)) {
+                Log.info(version + "\n");
+            }
             CLIHelp.showHelp(false);
-        } else if (args.length == 1 && args[0].equals("--version")) {
+        } else if (hasVersion(args)) {
             Log.info(version);
         } else {
             try {
                 Arguments arguments = new Arguments(args);
-                if (!arguments.processArguments()) { // processArguments() should log error message
-                                                     // if failed.
+                if (!arguments.processArguments()) {
+                    // processArguments() should log error message if failed.
                     return -1;
                 }
             } catch (Exception e) {
@@ -113,4 +116,13 @@
         return false;
     }
 
+    private static boolean hasVersion(String[] args) {
+        for (String a : args) {
+            if ("--version".equals(a) || "-v".equals(a)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
 }
--- a/test/jdk/tools/jpackage/JPackageNoArgTest.java	Tue Dec 11 12:54:18 2018 -0500
+++ b/test/jdk/tools/jpackage/JPackageNoArgTest.java	Wed Dec 12 08:27:16 2018 -0500
@@ -33,8 +33,8 @@
 public class JPackageNoArgTest {
 
     private static final String RESULT1 = "Usage: jpackage <mode> <options>";
-    private static final String RESULT2 =
-            "Use --help for a list of possible options";
+    private static final String[] EXPECTED =
+            {"--help", "list of possible options"};
 
     private static void validate(String output) throws Exception {
         String[] result = output.split("\n");
@@ -50,10 +50,12 @@
             throw new AssertionError("Unexpected line 1");
         }
 
-        if (!result[1].trim().equals(RESULT2)) {
-            System.err.println("Expected: " + RESULT2);
-            System.err.println("Actual: " + result[1]);
-            throw new AssertionError("Unexpected line 2");
+        for (String expected : EXPECTED) {
+            if (!result[1].contains(expected)) {
+                System.err.println("Expected to contain: " + expected);
+                System.err.println("Actual: " + result[1]);
+                throw new AssertionError("Unexpected line 2");
+            }
         }
     }
 
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java	Tue Dec 11 12:54:18 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java	Wed Dec 12 08:27:16 2018 -0500
@@ -27,7 +27,7 @@
 
 /*
  * @test
- * @summary jpackage create image --version test
+ * @summary jpackage create image --app-version test
  * @library ../helpers
  * @build JPackageHelper
  * @build JPackagePath
@@ -58,7 +58,7 @@
         "--class", "Hello",
         "--files", "hello.jar",
         "--force",
-        "--version", VERSION};
+        "--app-version", VERSION};
 
     private static void validate(String version)
             throws Exception {