29 import jdk.jpackage.internal.CLIHelp; 30 import java.io.PrintWriter; 31 import java.util.ResourceBundle; 32 import java.io.FileNotFoundException; 33 import java.io.IOException; 34 import java.text.MessageFormat; 35 36 public class Main { 37 38 private static final ResourceBundle I18N = ResourceBundle.getBundle( 39 "jdk.jpackage.internal.resources.MainResources"); 40 41 /** 42 * main(String... args) 43 * This is the entry point for the jpackage tool. 44 * 45 * @param args command line arguments 46 */ 47 public static void main(String... args) throws Exception { 48 // Create logger with default system.out and system.err 49 Log.Logger logger = new Log.Logger(false); 50 Log.setLogger(logger); 51 52 int status = new jdk.jpackage.main.Main().execute(args); 53 System.exit(status); 54 } 55 56 /** 57 * execute() - this is the entry point for the ToolProvider API. 58 * 59 * @param out output stream 60 * @param err error output stream 61 * @param args command line arguments 62 * @return an exit code. 0 means success, non-zero means an error occurred. 63 */ 64 public int execute(PrintWriter out, PrintWriter err, String... args) { 65 // Create logger with provided streams 66 Log.Logger logger = new Log.Logger(false); 67 logger.setPrintWriter(out, err); 68 Log.setLogger(logger); 69 70 return execute(args); 71 } 72 73 private int execute(String... args) { 74 try { 75 String[] newArgs; 76 try { 77 newArgs = CommandLine.parse(args); 78 } catch (FileNotFoundException fnfe) { 79 Log.error(MessageFormat.format(I18N.getString( 80 "ERR_CannotParseOptions"), fnfe.getMessage())); 81 return 1; 82 } catch (IOException ioe) { 83 Log.error(ioe.getMessage()); 84 return 1; 85 } 86 | 29 import jdk.jpackage.internal.CLIHelp; 30 import java.io.PrintWriter; 31 import java.util.ResourceBundle; 32 import java.io.FileNotFoundException; 33 import java.io.IOException; 34 import java.text.MessageFormat; 35 36 public class Main { 37 38 private static final ResourceBundle I18N = ResourceBundle.getBundle( 39 "jdk.jpackage.internal.resources.MainResources"); 40 41 /** 42 * main(String... args) 43 * This is the entry point for the jpackage tool. 44 * 45 * @param args command line arguments 46 */ 47 public static void main(String... args) throws Exception { 48 // Create logger with default system.out and system.err 49 Log.setLogger(null); 50 51 int status = new jdk.jpackage.main.Main().execute(args); 52 System.exit(status); 53 } 54 55 /** 56 * execute() - this is the entry point for the ToolProvider API. 57 * 58 * @param out output stream 59 * @param err error output stream 60 * @param args command line arguments 61 * @return an exit code. 0 means success, non-zero means an error occurred. 62 */ 63 public int execute(PrintWriter out, PrintWriter err, String... args) { 64 // Create logger with provided streams 65 Log.Logger logger = new Log.Logger(); 66 logger.setPrintWriter(out, err); 67 Log.setLogger(logger); 68 69 return execute(args); 70 } 71 72 private int execute(String... args) { 73 try { 74 String[] newArgs; 75 try { 76 newArgs = CommandLine.parse(args); 77 } catch (FileNotFoundException fnfe) { 78 Log.error(MessageFormat.format(I18N.getString( 79 "ERR_CannotParseOptions"), fnfe.getMessage())); 80 return 1; 81 } catch (IOException ioe) { 82 Log.error(ioe.getMessage()); 83 return 1; 84 } 85 |