< prev index next >

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java

Print this page




 235             }
 236             if (options.help) {
 237                 optionsHelper.showHelp(PROGNAME);
 238                 return EXIT_OK;
 239             }
 240             if (optionsHelper.shouldListPlugins()) {
 241                 optionsHelper.listPlugins();
 242                 return EXIT_OK;
 243             }
 244             if (options.version || options.fullVersion) {
 245                 taskHelper.showVersion(options.fullVersion);
 246                 return EXIT_OK;
 247             }
 248 
 249             if (taskHelper.getExistingImage() != null) {
 250                 postProcessOnly(taskHelper.getExistingImage());
 251                 return EXIT_OK;
 252             }
 253 
 254             if (options.modulePath.isEmpty()) {







 255                 throw taskHelper.newBadArgs("err.modulepath.must.be.specified")
 256                                 .showUsage(true);
 257             }

 258 
 259             JlinkConfiguration config = initJlinkConfig();
 260             if (options.suggestProviders) {
 261                 suggestProviders(config, remaining);
 262             } else {
 263                 createImage(config);
 264                 if (options.saveoptsfile != null) {
 265                     Files.write(Paths.get(options.saveoptsfile), getSaveOpts().getBytes());
 266                 }
 267             }
 268 
 269             return EXIT_OK;
 270         } catch (PluginException | IllegalArgumentException |
 271                  UncheckedIOException |IOException | FindException | ResolutionException e) {
 272             log.println(taskHelper.getMessage("error.prefix") + " " + e.getMessage());
 273             if (DEBUG) {
 274                 e.printStackTrace(log);
 275             }
 276             return EXIT_ERROR;
 277         } catch (BadArgs e) {




 235             }
 236             if (options.help) {
 237                 optionsHelper.showHelp(PROGNAME);
 238                 return EXIT_OK;
 239             }
 240             if (optionsHelper.shouldListPlugins()) {
 241                 optionsHelper.listPlugins();
 242                 return EXIT_OK;
 243             }
 244             if (options.version || options.fullVersion) {
 245                 taskHelper.showVersion(options.fullVersion);
 246                 return EXIT_OK;
 247             }
 248 
 249             if (taskHelper.getExistingImage() != null) {
 250                 postProcessOnly(taskHelper.getExistingImage());
 251                 return EXIT_OK;
 252             }
 253 
 254             if (options.modulePath.isEmpty()) {
 255                 // no --module-path specified - try to set $JAVA_HOME/jmods if that exists
 256                 Path jmods = JlinkConfiguration.getDefaultModulePath();
 257                 if (jmods != null) {
 258                     options.modulePath.add(jmods);
 259                 }
 260 
 261                 if (options.modulePath.isEmpty()) {
 262                     throw taskHelper.newBadArgs("err.modulepath.must.be.specified")
 263                                 .showUsage(true);
 264                 }
 265             }
 266 
 267             JlinkConfiguration config = initJlinkConfig();
 268             if (options.suggestProviders) {
 269                 suggestProviders(config, remaining);
 270             } else {
 271                 createImage(config);
 272                 if (options.saveoptsfile != null) {
 273                     Files.write(Paths.get(options.saveoptsfile), getSaveOpts().getBytes());
 274                 }
 275             }
 276 
 277             return EXIT_OK;
 278         } catch (PluginException | IllegalArgumentException |
 279                  UncheckedIOException |IOException | FindException | ResolutionException e) {
 280             log.println(taskHelper.getMessage("error.prefix") + " " + e.getMessage());
 281             if (DEBUG) {
 282                 e.printStackTrace(log);
 283             }
 284             return EXIT_ERROR;
 285         } catch (BadArgs e) {


< prev index next >