List of usage examples for java.lang Exception printStackTrace
public void printStackTrace()
From source file:com.level3.hiper.dyconn.be.Main.java
public static void main(String... args) { try {/* w w w . jav a2 s . co m*/ String bootstrap = "/dyconn-be-toml.cfg"; CommandLineParser parser = new DefaultParser(); Options options = new Options(); options.addOption("c", "config-file", true, "configuration for hapi dyconn module"); try { CommandLine line = parser.parse(options, args); if (line.hasOption("config-file")) { bootstrap = line.getOptionValue("config-file"); } } catch (ParseException ex) { log.error("command line", ex); return; } // read config file log.info("loading configuration"); Config.instance().initialize(bootstrap); // initialize queue subsystem log.info("initializing messaging"); Broker.instance().initialize(); // initilaize persistence log.info("starting exector"); ExecutorService executor = Executors.newSingleThreadExecutor(); executor.submit(new MsgReceiver()); } catch (Exception e) { e.printStackTrace(); } }
From source file:MethodInfoDemo.java
/** * Demo method.//from w w w . ja v a 2 s .c om * * @param args * Command line arguments. */ public static void main(final String[] args) { String s = ""; printMethodInfo(s); try { emptyStrings(s); } catch (final Exception ex) { ex.printStackTrace(); } }
From source file:com.cardFetcher.Core.NetrunnerCardFetcher.java
public static void main(String[] args) { // String setsPath = "GameDatabase\\0f38e453-26df-4c04-9d67-6d43de939c77\\Sets"; // String imagesPath = "ImageDatabase\\0f38e453-26df-4c04-9d67-6d43de939c77\\Sets"; String setsPath = "C:\\Users\\jose.gonzalez\\Documents\\OCTGN\\GameDatabase\\0f38e453-26df-4c04-9d67-6d43de939c77\\Sets"; String imagesPath = "C:\\Users\\jose.gonzalez\\Documents\\OCTGN\\ImageDatabase\\0f38e453-26df-4c04-9d67-6d43de939c77\\Sets"; // String setsPath = "C:\\Users\\jgonzal2\\Documents\\OCTGN\\GameDatabase\\0f38e453-26df-4c04-9d67-6d43de939c77\\Sets"; // String imagesPath = "C:\\Users\\jgonzal2\\Documents\\OCTGN\\ImageDatabase\\0f38e453-26df-4c04-9d67-6d43de939c77\\Sets"; try {/*from w w w. ja va2 s .c o m*/ JSONArray json = JSONFetcher.getJSON(); //System.out.println(json); File f = new File(setsPath); File[] files = f.listFiles(); int count = 0; for (File file : files) { if (file.isDirectory()) { Set s = XmlParser.parseXML(file.getCanonicalPath() + "\\set.xml"); if ((!s.getSetName().equals("Promos")) && (!s.getSetName().equals("Markers"))) { //System.out.println(s); ImageFetcher fetch = new ImageFetcher(s, imagesPath, json); System.out.print("thread " + count++ + ": "); fetch.start(); } } } } catch (Exception e) { e.printStackTrace(); } }
From source file:eu.stratosphere.yarn.YarnTaskManagerRunner.java
public static void main(final String[] args) throws IOException { Map<String, String> envs = System.getenv(); final String yarnClientUsername = envs.get(Client.ENV_CLIENT_USERNAME); final String localDirs = envs.get(Environment.LOCAL_DIRS.key()); // configure local directory final String[] newArgs = Arrays.copyOf(args, args.length + 2); newArgs[newArgs.length - 2] = "-" + TaskManager.ARG_CONF_DIR; newArgs[newArgs.length - 1] = localDirs; LOG.info("Setting log path " + localDirs); LOG.info("YARN daemon runs as '" + UserGroupInformation.getCurrentUser().getShortUserName() + "' setting" + " user to execute Stratosphere TaskManager to '" + yarnClientUsername + "'"); UserGroupInformation ugi = UserGroupInformation.createRemoteUser(yarnClientUsername); for (Token<? extends TokenIdentifier> toks : UserGroupInformation.getCurrentUser().getTokens()) { ugi.addToken(toks);/*from w w w .j a v a 2 s .c o m*/ } ugi.doAs(new PrivilegedAction<Object>() { @Override public Object run() { try { TaskManager.main(newArgs); } catch (Exception e) { e.printStackTrace(); } return null; } }); }
From source file:com.mtea.macrotea_httpclient_study.ClientAbortMethod.java
public final static void main(String[] args) throws Exception { //? DefaultHttpClient HttpClient httpclient = new DefaultHttpClient(); try {//from www . j a va2 s .c o m HttpGet httpget = new HttpGet("http://www.baidu.com/"); System.out.println("executing request " + httpget.getURI()); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); System.out.println("----------------------------------------"); System.out.println("RequestLine:" + httpget.getRequestLine()); System.out.println("RequestLine:" + response.getStatusLine()); if (entity != null) { System.out.println("Response content length: " + entity.getContentLength()); } System.out.println("----------------------------------------"); // EntityUtils.consume(entity); //??response?httpget httpget.abort(); } catch (Exception e) { e.printStackTrace(); } finally { //??httpclient??? httpclient.getConnectionManager().shutdown(); } }
From source file:dk.qabi.imapfs.IMAPMount.java
public static void main(String[] args) throws MessagingException, MalformedURLException { if (args.length < 2) { System.out.println("[Error]: Must specify a mounting point"); System.out.println();/*w ww . j a va 2 s.co m*/ System.out.println("[Usage]: imapfsmnt <mounting point>"); System.exit(-1); } final String urlSpec = args[0]; final URL url = new URL(null, urlSpec, new IMAPStreamHandler()); final String mountpoint = args[1]; String[] fs_args = new String[4]; fs_args[0] = "-f"; fs_args[1] = "-s"; fs_args[2] = mountpoint; fs_args[3] = "-ovolname=" + url.getHost() + ",fssubtype=7"; Filesystem imapfs = new LoggingFilesystem(new IMAPFileSystem(url), LogFactory.getLog("dk.qabi.imapfs")); File m = new File(mountpoint); if (!m.exists()) m.mkdirs(); try { FuseMount.mount(fs_args, imapfs); } catch (Exception e) { e.printStackTrace(); } }
From source file:edu.harvard.med.iccbl.screensaver.io.libraries.CreateLibraryWells.java
@SuppressWarnings("static-access") public static void main(String[] args) { final CommandLineApplication app = new CommandLineApplication(args); app.addCommandLineOption(OptionBuilder.hasArgs().isRequired().withArgName("short name") .withLongOpt("short-name").withDescription("a short name for identifying the library").create("l")); app.processOptions(true, false);//from w ww.j a v a 2 s.c om final GenericEntityDAO dao = (GenericEntityDAO) app.getSpringBean("genericEntityDao"); dao.doInTransaction(new DAOTransaction() { @Override public void runTransaction() { try { LibraryCreator libraryCreator = (LibraryCreator) app.getSpringBean("libraryCreator"); List<String> libraryShortNames = app.getCommandLineOptionValues("l"); for (String libraryShortName : libraryShortNames) { libraryCreator.createWells( dao.findEntityByProperty(Library.class, "shortName", libraryShortName)); } } catch (Exception e) { e.printStackTrace(); log.error(e.toString()); System.err.println("error: " + e.getMessage()); System.exit(1); } } }); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); DrawPanel dp = new DrawPanel(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(dp);// ww w . jav a 2 s . com frame.pack(); frame.setLocationByPlatform(true); try { Sequence seq = new Sequence(Sequence.PPQ, 4); Track track = seq.createTrack(); for (int i = 0; i < 120; i += 4) { int d = (int) Math.abs(new Random().nextGaussian() * 24) + 32; track.add(makeEvent(ShortMessage.NOTE_ON, 1, d, 127, i)); track.add(makeEvent(ShortMessage.CONTROL_CHANGE, 1, 127, 0, i)); track.add(makeEvent(ShortMessage.NOTE_OFF, 1, d, 127, i)); } Sequencer sequencer = MidiSystem.getSequencer(); sequencer.open(); sequencer.setSequence(seq); sequencer.addControllerEventListener(dp, new int[] { 127 }); sequencer.start(); } catch (Exception e) { e.printStackTrace(); } frame.setVisible(true); }
From source file:sample.jetty.SampleJettyApplication.java
public static void main(String[] args) throws Exception { InputStream inputstream = null; try {//from www.java2 s . c o m Properties pro = new Properties(); //????? URL url = org.springframework.util.ResourceUtils.getURL("classpath:MySql_general.properties"); inputstream = url.openStream(); pro.load(inputstream); //new EmbedMySqlServer(pro).startup(); String dbPath = (new File("")).getAbsolutePath() + "/db/"; dbPath = dbPath.replaceAll("\\\\", "/"); //??? EmbedMySqlServer mysqldbServer = new EmbedMySqlServer(pro, dbPath /*"C:\\gfworklog\\db\\"*/); SampleJettyApplication.MAIN_THREAD_LOCAL.put("embedMysqlServer", mysqldbServer); mysqldbServer.startup(); } catch (Exception e) { e.printStackTrace(); } finally { try { inputstream.close(); } catch (Exception ex) { } } System.out.println(Thread.currentThread().getName() + " ========================= " + 1 + " ========================="); ConfigurableApplicationContext cac = SpringApplication.run(SampleJettyApplication.class, args); }
From source file:com.lostinsoftware.xsdparser.XSDParserTest.java
public static void main(String[] argv) { try {/*from www.ja va 2 s .c om*/ URL url = XSDParserTest.class.getClassLoader() .getResource("com/lostinsoftware/xsdparser/xsd/database_test.xsd"); List<String> data = Arrays.asList(elements); XSDElement mainElement = XSDParser.parseXSD(url, data); // Print all data System.out.println("=============== Only some elements ======================="); printData(mainElement, 0); mainElement = XSDParser.parseXSD(url, "database"); // Print all data System.out.println("\n\n=============== All elements ======================="); printData(mainElement, 0); } catch (Exception ex) { ex.printStackTrace(); } }