List of usage examples for org.apache.commons.cli Options addOption
public Options addOption(String opt, String longOpt, boolean hasArg, String description)
From source file:javadepchecker.Main.java
/** * @param args the command line arguments */// w ww.j av a 2 s . c o m public static void main(String[] args) throws IOException { int exit = 0; try { CommandLineParser parser = new PosixParser(); Options options = new Options(); options.addOption("h", "help", false, "print help"); options.addOption("i", "image", true, "image directory"); options.addOption("v", "verbose", false, "print verbose output"); CommandLine line = parser.parse(options, args); String[] files = line.getArgs(); if (line.hasOption("h") || files.length == 0) { HelpFormatter h = new HelpFormatter(); h.printHelp("java-dep-check [-i <image] <package.env>+", options); } else { image = line.getOptionValue("i", ""); for (String arg : files) { if (line.hasOption('v')) System.out.println("Checking " + arg); if (!checkPkg(new File(arg))) { exit = 1; } } } } catch (ParseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } System.exit(exit); }
From source file:boa.evaluator.BoaEvaluator.java
public static void main(final String[] args) { final Options options = new Options(); options.addOption("i", "input", true, "input Boa source file (*.boa)"); options.addOption("d", "data", true, "path to local data directory"); options.addOption("o", "output", true, "output directory"); options.getOption("i").setRequired(true); options.getOption("d").setRequired(true); try {/* w w w . ja v a2s.c o m*/ if (args.length == 0) { printHelp(options, null); return; } else { final CommandLine cl = new PosixParser().parse(options, args); if (cl.hasOption('i') && cl.hasOption('d')) { final BoaEvaluator evaluator; try { if (cl.hasOption('o')) { evaluator = new BoaEvaluator(cl.getOptionValue('i'), cl.getOptionValue('d'), cl.getOptionValue('o')); } else { evaluator = new BoaEvaluator(cl.getOptionValue('i'), cl.getOptionValue('d')); } } catch (final IOException e) { System.err.print(e); return; } if (!evaluator.compile()) { System.err.println("Compilation Failed"); return; } final long start = System.currentTimeMillis(); evaluator.evaluate(); final long end = System.currentTimeMillis(); System.out.println("Total Time Taken: " + (end - start)); System.out.println(evaluator.getResults()); } else { printHelp(options, "missing required options: -i <arg> and -d <arg>"); return; } } } catch (final org.apache.commons.cli.ParseException e) { printHelp(options, e.getMessage()); } }
From source file:com.continuuity.loom.runtime.DummyProvisioner.java
public static void main(final String[] args) throws Exception { Options options = new Options(); options.addOption("h", "host", true, "Loom server to connect to"); options.addOption("p", "port", true, "Loom server port to connect to"); options.addOption("c", "concurrency", true, "default concurrent threads"); options.addOption("f", "failurePercent", true, "% of the time a provisioner should fail its task"); options.addOption("o", "once", false, "whether or not only one task should be taken before exiting"); options.addOption("d", "taskDuration", true, "number of milliseconds it should take to finish a task"); options.addOption("s", "sleepMs", true, "number of milliseconds a thread will sleep before taking another task"); options.addOption("n", "numTasks", true, "number of tasks to try and take from the queue. Default is infinite."); options.addOption("t", "tenant", true, "tenant id to use."); try {/*from w w w . j av a2 s. c o m*/ CommandLineParser parser = new BasicParser(); CommandLine cmd = parser.parse(options, args); host = cmd.hasOption('h') ? cmd.getOptionValue('h') : "localhost"; port = cmd.hasOption('p') ? Integer.valueOf(cmd.getOptionValue('p')) : 55054; concurrency = cmd.hasOption('c') ? Integer.valueOf(cmd.getOptionValue('c')) : 5; failurePercent = cmd.hasOption('f') ? Integer.valueOf(cmd.getOptionValue('f')) : 0; runOnce = cmd.hasOption('o'); taskMs = cmd.hasOption('d') ? Long.valueOf(cmd.getOptionValue('d')) : 1000; sleepMs = cmd.hasOption('s') ? Long.valueOf(cmd.getOptionValue('s')) : 1000; numTasks = cmd.hasOption('n') ? Integer.valueOf(cmd.getOptionValue('n')) : -1; tenant = cmd.hasOption('t') ? cmd.getOptionValue('t') : "loom"; } catch (ParseException e) { LOG.error("exception parsing input arguments.", e); return; } if (concurrency < 1) { LOG.error("invalid concurrency level {}.", concurrency); return; } if (runOnce) { new Provisioner("dummy-0", tenant, host, port, failurePercent, taskMs, sleepMs, 1).runOnce(); } else { LOG.info(String.format( "running with %d threads, connecting to %s:%d using tenant %s, with a failure rate of" + "%d percent, task time of %d ms, and sleep time of %d ms between fetches", concurrency, host, port, tenant, failurePercent, taskMs, sleepMs)); pool = Executors.newFixedThreadPool(concurrency); try { int tasksPerProvisioner = numTasks >= 0 ? numTasks / concurrency : -1; int extra = numTasks < 0 ? 0 : numTasks % concurrency; pool.execute(new Provisioner("dummy-0", tenant, host, port, failurePercent, taskMs, sleepMs, tasksPerProvisioner + extra)); for (int i = 1; i < concurrency; i++) { pool.execute(new Provisioner("dummy-" + i, tenant, host, port, failurePercent, taskMs, sleepMs, tasksPerProvisioner)); } } catch (Exception e) { LOG.error("Caught exception, shutting down now.", e); pool.shutdownNow(); } pool.shutdown(); } }
From source file:com.trendmicro.hdfs.webdav.Main.java
public static void main(String[] args) { HDFSWebDAVServlet servlet = HDFSWebDAVServlet.getServlet(); Configuration conf = servlet.getConfiguration(); // Process command line Options options = new Options(); options.addOption("d", "debug", false, "Enable debug logging"); options.addOption("p", "port", true, "Port to bind to [default: 8080]"); options.addOption("b", "bind-address", true, "Address or hostname to bind to [default: 0.0.0.0]"); options.addOption("g", "ganglia", true, "Send Ganglia metrics to host:port [default: none]"); CommandLine cmd = null;//from w w w. j av a 2s .c o m try { cmd = new PosixParser().parse(options, args); } catch (ParseException e) { printUsageAndExit(options, -1); } if (cmd.hasOption('d')) { Logger rootLogger = Logger.getLogger("com.trendmicro"); rootLogger.setLevel(Level.DEBUG); } if (cmd.hasOption('b')) { conf.set("hadoop.webdav.bind.address", cmd.getOptionValue('b')); } if (cmd.hasOption('p')) { conf.setInt("hadoop.webdav.port", Integer.valueOf(cmd.getOptionValue('p'))); } String gangliaHost = null; int gangliaPort = 8649; if (cmd.hasOption('g')) { String val = cmd.getOptionValue('g'); if (val.indexOf(':') != -1) { String[] split = val.split(":"); gangliaHost = split[0]; gangliaPort = Integer.valueOf(split[1]); } else { gangliaHost = val; } } InetSocketAddress addr = getAddress(conf); // Log in the server principal from keytab UserGroupInformation.setConfiguration(conf); if (UserGroupInformation.isSecurityEnabled()) try { SecurityUtil.login(conf, "hadoop.webdav.server.kerberos.keytab", "hadoop.webdav.server.kerberos.principal", addr.getHostName()); } catch (IOException e) { LOG.fatal("Could not log in", e); System.err.println("Could not log in"); System.exit(-1); } // Set up embedded Jetty Server server = new Server(); server.setSendServerVersion(false); server.setSendDateHeader(false); server.setStopAtShutdown(true); // Set up connector Connector connector = new SelectChannelConnector(); connector.setPort(addr.getPort()); connector.setHost(addr.getHostName()); server.addConnector(connector); LOG.info("Listening on " + addr); // Set up context Context context = new Context(server, "/", Context.SESSIONS); // WebDAV servlet ServletHolder servletHolder = new ServletHolder(servlet); servletHolder.setInitParameter("authenticate-header", "Basic realm=\"Hadoop WebDAV Server\""); context.addServlet(servletHolder, "/*"); // metrics instrumentation filter context.addFilter(new FilterHolder(new DefaultWebappMetricsFilter()), "/*", 0); // auth filter context.addFilter(new FilterHolder(new AuthFilter(conf)), "/*", 0); server.setHandler(context); // Set up Ganglia metrics reporting if (gangliaHost != null) { GangliaReporter.enable(1, TimeUnit.MINUTES, gangliaHost, gangliaPort); } // Start and join the server thread try { server.start(); server.join(); } catch (Exception e) { LOG.fatal("Failed to start Jetty", e); System.err.println("Failed to start Jetty"); System.exit(-1); } }
From source file:net.iridiant.hdfs.webdav.Main.java
public static void main(String[] args) { HDFSWebDAVServlet servlet = HDFSWebDAVServlet.getServlet(); Configuration conf = servlet.getConfiguration(); // Process command line Options options = new Options(); options.addOption("d", "debug", false, "Enable debug logging"); options.addOption("p", "port", true, "Port to bind to [default: 8080]"); options.addOption("b", "bind-address", true, "Address or hostname to bind to [default: 0.0.0.0]"); options.addOption("g", "ganglia", true, "Send Ganglia metrics to host:port [default: none]"); CommandLine cmd = null;/* w w w.ja va 2 s . c o m*/ try { cmd = new PosixParser().parse(options, args); } catch (ParseException e) { printUsageAndExit(options, -1); } if (cmd.hasOption('d')) { Logger rootLogger = Logger.getLogger("net.iridiant"); rootLogger.setLevel(Level.DEBUG); } if (cmd.hasOption('b')) { conf.set("hadoop.webdav.bind.address", cmd.getOptionValue('b')); } if (cmd.hasOption('p')) { conf.setInt("hadoop.webdav.port", Integer.valueOf(cmd.getOptionValue('p'))); } String gangliaHost = null; int gangliaPort = 8649; if (cmd.hasOption('g')) { String val = cmd.getOptionValue('g'); if (val.indexOf(':') != -1) { String[] split = val.split(":"); gangliaHost = split[0]; gangliaPort = Integer.valueOf(split[1]); } else { gangliaHost = val; } } InetSocketAddress addr = getAddress(conf); // Log in the server principal from keytab UserGroupInformation.setConfiguration(conf); if (UserGroupInformation.isSecurityEnabled()) try { SecurityUtil.login(conf, "hadoop.webdav.server.kerberos.keytab", "hadoop.webdav.server.kerberos.principal", addr.getHostName()); } catch (IOException e) { LOG.fatal("Could not log in", e); System.err.println("Could not log in"); System.exit(-1); } // Set up embedded Jetty Server server = new Server(); server.setSendServerVersion(false); server.setSendDateHeader(false); server.setStopAtShutdown(true); // Set up connector Connector connector = new SelectChannelConnector(); connector.setPort(addr.getPort()); connector.setHost(addr.getHostName()); server.addConnector(connector); LOG.info("Listening on " + addr); // Set up context Context context = new Context(server, "/", Context.SESSIONS); // WebDAV servlet ServletHolder servletHolder = new ServletHolder(servlet); servletHolder.setInitParameter("authenticate-header", "Basic realm=\"Hadoop WebDAV Server\""); context.addServlet(servletHolder, "/*"); // metrics instrumentation filter context.addFilter(new FilterHolder(new DefaultWebappMetricsFilter()), "/*", 0); // auth filter context.addFilter(new FilterHolder(new AuthFilter(conf)), "/*", 0); server.setHandler(context); // Set up Ganglia metrics reporting if (gangliaHost != null) { GangliaReporter.enable(1, TimeUnit.MINUTES, gangliaHost, gangliaPort); } // Start and join the server thread try { server.start(); server.join(); } catch (Exception e) { LOG.fatal("Failed to start Jetty", e); System.err.println("Failed to start Jetty"); System.exit(-1); } }
From source file:bbs.monitor.ListNode.java
public static void main(String[] args) throws Exception { boolean printRawForm = false; String transport = null;/* w w w.j a va2 s .c o m*/ String selfAddressAndPort = null; // parse command-line arguments Options opts = new Options(); opts.addOption("h", "help", false, "print help"); opts.addOption("r", "raw", false, "print nodes in the raw form (hostname:port)"); opts.addOption("t", "transport", true, "transpoft, UDP or TCP"); opts.addOption("s", "selfipaddress", true, "self IP address (and port)"); CommandLineParser parser = new PosixParser(); CommandLine cmd = null; try { cmd = parser.parse(opts, args); } catch (ParseException e) { System.out.println("There is an invalid option."); e.printStackTrace(); System.exit(1); } String optVal; if (cmd.hasOption('h')) { usage(COMMAND); System.exit(1); } if (cmd.hasOption('r')) { printRawForm = true; } optVal = cmd.getOptionValue('t'); if (optVal != null) { transport = optVal; } optVal = cmd.getOptionValue('s'); if (optVal != null) { selfAddressAndPort = optVal; } args = cmd.getArgs(); // parse initial contact String contactHostAndPort = null; int contactPort = -1; if (args.length < 1) { usage(COMMAND); System.exit(1); } contactHostAndPort = args[0]; if (args.length >= 2) contactPort = Integer.parseInt(args[1]); // // prepare a NodeCollector and invoke it // // prepare StatConfiguration StatConfiguration config = StatFactory.getDefaultConfiguration(); config.setDoUPnPNATTraversal(false); if (transport != null) { config.setMessagingTransport(transport); } if (selfAddressAndPort != null) { MessagingUtility.HostAndPort hostAndPort = MessagingUtility.parseHostnameAndPort(selfAddressAndPort, config.getSelfPort()); config.setSelfAddress(hostAndPort.getHostName()); config.setSelfPort(hostAndPort.getPort()); } // prepare MessageReceiver and initial contact MessagingProvider provider = config.deriveMessagingProvider(); MessageReceiver receiver = config.deriveMessageReceiver(provider); MessagingAddress contact; try { contact = provider.getMessagingAddress(contactHostAndPort, contactPort); } catch (IllegalArgumentException e) { contact = provider.getMessagingAddress(contactHostAndPort, config.getContactPort()); } // prepare a callback NodeCollectorCallback cb; if (printRawForm) { cb = new NodeCollectorCallback() { public void addNode(ID id, MessagingAddress address) { System.out.println(new MessagingUtility.HostAndPort(address.getHostname(), address.getPort())); // <hostname>:<port> } public void removeNode(ID id) { } }; } else { cb = new NodeCollectorCallback() { public void addNode(ID id, MessagingAddress address) { //System.out.println(HTMLUtil.convertMessagingAddressToURL(address)); System.out.println("http://" + address.getHostAddress() + ":" + address.getPort() + "/"); // http://<hostname>:port/ } public void removeNode(ID id) { } }; } // instantiate and invoke a NodeCollector NodeCollector collector = StatFactory.getNodeCollector(config, contact, cb, receiver); collector.investigate(); // stop MessageReceiver to prevent // handling incoming messages and submissions to a thread pool receiver.stop(); }
From source file:ab.demo.MainEntry.java
public static void main(String args[]) { LoggingHandler.initConsoleLog();/*from w w w. jav a 2 s . c o m*/ //args = new String[]{"-su"}; Options options = new Options(); options.addOption("s", "standalone", false, "runs the reinforcement learning agent in standalone mode"); options.addOption("p", "proxyPort", true, "the port which is to be used by the proxy"); options.addOption("h", "help", false, "displays this help"); options.addOption("n", "naiveAgent", false, "runs the naive agent in standalone mode"); options.addOption("c", "competition", false, "runs the naive agent in the server/client competition mode"); options.addOption("u", "updateDatabaseTables", false, "executes CREATE TABLE IF NOT EXIST commands"); options.addOption("l", "level", true, "if set the agent is playing only in this one level"); options.addOption("m", "manual", false, "runs the empirical threshold determination agent in standalone mode"); options.addOption("r", "real", false, "shows the recognized shapes in a new frame"); CommandLineParser parser = new DefaultParser(); CommandLine cmd; StandaloneAgent agent; Properties properties = new Properties(); InputStream configInputStream = null; try { Class.forName("org.sqlite.JDBC"); //parse configuration file configInputStream = new FileInputStream("config.properties"); properties.load(configInputStream); } catch (IOException exception) { exception.printStackTrace(); } catch (ClassNotFoundException exception) { exception.printStackTrace(); } finally { if (configInputStream != null) { try { configInputStream.close(); } catch (IOException exception) { exception.printStackTrace(); } } } String dbPath = properties.getProperty("db_path"); String dbUser = properties.getProperty("db_user"); String dbPass = properties.getProperty("db_pass"); DBI dbi = new DBI(dbPath, dbUser, dbPass); QValuesDAO qValuesDAO = dbi.open(QValuesDAO.class); GamesDAO gamesDAO = dbi.open(GamesDAO.class); MovesDAO movesDAO = dbi.open(MovesDAO.class); ProblemStatesDAO problemStatesDAO = dbi.open(ProblemStatesDAO.class); try { cmd = parser.parse(options, args); if (cmd.hasOption("help")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("help", options); return; } int proxyPort = 9000; if (cmd.hasOption("proxyPort")) { proxyPort = Integer.parseInt(cmd.getOptionValue("proxyPort")); logger.info("Set proxy port to " + proxyPort); } Proxy.setPort(proxyPort); LoggingHandler.initFileLog(); if (cmd.hasOption("standalone")) { agent = new ReinforcementLearningAgent(gamesDAO, movesDAO, problemStatesDAO, qValuesDAO); } else if (cmd.hasOption("naiveAgent")) { agent = new NaiveStandaloneAgent(); } else if (cmd.hasOption("manual")) { agent = new ManualGamePlayAgent(gamesDAO, movesDAO, problemStatesDAO); } else if (cmd.hasOption("competition")) { System.out.println("We haven't implemented a competition ready agent yet."); return; } else { System.out.println("Please specify which solving strategy we should be using."); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("help", options); return; } if (cmd.hasOption("updateDatabaseTables")) { qValuesDAO.createTable(); gamesDAO.createTable(); movesDAO.createTable(); problemStatesDAO.createTable(); problemStatesDAO.createObjectsTable(); } if (cmd.hasOption("level")) { agent.setFixedLevel(Integer.parseInt(cmd.getOptionValue("level"))); } if (cmd.hasOption("real")) { ShowSeg.useRealshape = true; Thread thread = new Thread(new ShowSeg()); thread.start(); } } catch (UnrecognizedOptionException e) { System.out.println("Unrecognized commandline option: " + e.getOption()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("help", options); return; } catch (ParseException e) { System.out.println( "There was an error while parsing your command line input. Did you rechecked your syntax before running?"); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("help", options); return; } agent.run(); }
From source file:net.mmberg.nadia.processor.NadiaProcessor.java
/** * @param args/* w w w . ja v a 2s . c o m*/ */ @SuppressWarnings("static-access") public static void main(String[] args) { Class<? extends UserInterface> ui_class = ConsoleInterface.class; //default UI String dialog_file = default_dialog; //default dialogue //process command line args Options cli_options = new Options(); cli_options.addOption("h", "help", false, "print this message"); cli_options.addOption(OptionBuilder.withLongOpt("interface").withDescription("select user interface") .hasArg(true).withArgName("console, rest").create("i")); cli_options.addOption("f", "file", true, "specify dialogue path and file, e.g. -f /res/dialogue1.xml"); cli_options.addOption("r", "resource", true, "load dialogue (by name) from resources, e.g. -r dialogue1"); cli_options.addOption("s", "store", true, "load dialogue (by name) from internal store, e.g. -s dialogue1"); CommandLineParser parser = new org.apache.commons.cli.BasicParser(); try { CommandLine cmd = parser.parse(cli_options, args); //Help if (cmd.hasOption("h")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("nadia", cli_options, true); return; } //UI if (cmd.hasOption("i")) { String interf = cmd.getOptionValue("i"); if (interf.equals("console")) ui_class = ConsoleInterface.class; else if (interf.equals("rest")) ui_class = RESTInterface.class; } //load dialogue from path file if (cmd.hasOption("f")) { dialog_file = "file:///" + cmd.getOptionValue("f"); } //load dialogue from resources if (cmd.hasOption("r")) { dialog_file = config.getProperty(NadiaProcessorConfig.DIALOGUEDIR) + "/" + cmd.getOptionValue("r") + ".xml"; } //load dialogue from internal store if (cmd.hasOption("s")) { Dialog store_dialog = DialogStore.getInstance().getDialogFromStore((cmd.getOptionValue("s"))); store_dialog.save(); dialog_file = config.getProperty(NadiaProcessorConfig.DIALOGUEDIR) + "/" + cmd.getOptionValue("s") + ".xml"; } } catch (ParseException e1) { logger.severe("NADIA: loading by main-method failed. " + e1.getMessage()); e1.printStackTrace(); } //start Nadia with selected UI default_dialog = dialog_file; NadiaProcessor nadia = new NadiaProcessor(); try { ui = ui_class.newInstance(); ui.register(nadia); ui.start(); } catch (Exception e) { e.printStackTrace(); } }
From source file:net.mybox.mybox.ClientSetup.java
/** * Handle command line arguments/*ww w.ja v a 2 s. c o m*/ * @param args */ public static void main(String[] args) { Options options = new Options(); options.addOption("a", "apphome", true, "application home directory"); options.addOption("h", "help", false, "show help screen"); options.addOption("V", "version", false, "print the Mybox version"); CommandLineParser line = new GnuParser(); CommandLine cmd = null; String configDir = Client.defaultConfigDir; try { cmd = line.parse(options, args); } catch (Exception exp) { System.err.println(exp.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(Client.class.getName(), options); return; } if (cmd.hasOption("h")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(Client.class.getName(), options); return; } if (cmd.hasOption("V")) { Client.printMessage("version " + Common.appVersion); return; } if (cmd.hasOption("a")) { String appHomeDir = cmd.getOptionValue("a"); try { Common.updatePaths(appHomeDir); } catch (FileNotFoundException e) { Client.printErrorExit(e.getMessage()); } Client.updatePaths(); } ClientSetup setup = new ClientSetup(); }
From source file:de.mfo.jsurf.Main.java
/** * @param args// w w w. java 2 s. c o m */ public static void main(String[] args) { String jsurf_filename = ""; Options options = new Options(); options.addOption("s", "size", true, "width (and height) of a image (default: " + size + ")"); options.addOption("q", "quality", true, "quality of the rendering: 0 (low), 1 (medium, default), 2 (high), 3 (extreme)"); options.addOption("o", "output", true, "output PNG into this file (- means standard output. Use ./- to denote a file literally named -.)"); CommandLineParser parser = new PosixParser(); HelpFormatter formatter = new HelpFormatter(); String cmd_line_syntax = "jsurf [options] jsurf_file"; String help_header = "jsurf is a renderer for algebraic surfaces. If - is specified as a filename the jsurf file is read from standard input. " + "Use ./- to denote a file literally named -."; String help_footer = ""; try { CommandLine cmd = parser.parse(options, args); if (cmd.getArgs().length > 0) jsurf_filename = cmd.getArgs()[0]; else { formatter.printHelp(cmd_line_syntax, help_header, options, help_footer); return; } if (cmd.hasOption("output")) { } if (cmd.hasOption("size")) size = Integer.parseInt(cmd.getOptionValue("size")); int quality = 1; if (cmd.hasOption("quality")) quality = Integer.parseInt(cmd.getOptionValue("quality")); switch (quality) { case 0: aam = AntiAliasingMode.ADAPTIVE_SUPERSAMPLING; aap = AntiAliasingPattern.OG_1x1; break; case 2: aam = AntiAliasingMode.ADAPTIVE_SUPERSAMPLING; aap = AntiAliasingPattern.OG_4x4; break; case 3: aam = AntiAliasingMode.SUPERSAMPLING; aap = AntiAliasingPattern.OG_4x4; break; case 1: aam = AntiAliasingMode.ADAPTIVE_SUPERSAMPLING; aap = AntiAliasingPattern.QUINCUNX; } } catch (ParseException exp) { System.out.println("Unexpected exception:" + exp.getMessage()); System.exit(-1); } catch (NumberFormatException nfe) { formatter.printHelp(cmd_line_syntax, help_header, options, help_footer); System.exit(-1); } final Properties jsurf = new Properties(); try { if (jsurf_filename.equals("-")) jsurf.load(System.in); else jsurf.load(new FileReader(jsurf_filename)); FileFormat.load(jsurf, asr); } catch (Exception e) { System.err.println("Unable to read jsurf file " + jsurf_filename); e.printStackTrace(); System.exit(-2); } asr.setAntiAliasingMode(aam); asr.setAntiAliasingPattern(aap); // display the image in a window final String window_title = "jsurf: " + jsurf_filename; SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame f = new JFrame(window_title); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSurferRenderPanel p = null; try { p = new JSurferRenderPanel(jsurf); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } f.setContentPane(p); // f.getContentPane().add( new JLabel( new ImageIcon( window_image ) ) ); f.pack(); // f.setResizable( false ); f.setVisible(true); } }); }