List of usage examples for java.lang System exit
public static void exit(int status)
From source file:examples.CheckSessionState.java
public static void main(String[] args) { if (args.length == 0) { System.err.println("At least one path to serialized session required."); System.exit(1); }/*ww w . j a v a 2 s . c om*/ for (String sessionStatePath : args) { try { File sessionStateFile = new File(sessionStatePath); SessionState sessionState = JACKSON.readValue(sessionStateFile, SessionState.class); final AtomicInteger idx = new AtomicInteger(0); sessionState.foreachPartition(new Action1<PartitionState>() { @Override public void call(PartitionState state) { int partition = idx.getAndIncrement(); if (lessThan(state.getEndSeqno(), state.getStartSeqno())) { System.out.printf("stream request for partition %d will fail because " + "start sequence number (%d) is larger than " + "end sequence number (%d)\n", partition, state.getStartSeqno(), state.getEndSeqno()); } if (lessThan(state.getStartSeqno(), state.getSnapshotStartSeqno())) { System.out.printf( "stream request for partition %d will fail because " + "snapshot start sequence number (%d) must not be larger than " + "start sequence number (%d)\n", partition, state.getSnapshotStartSeqno(), state.getStartSeqno()); } if (lessThan(state.getSnapshotEndSeqno(), state.getStartSeqno())) { System.out.printf( "stream request for partition %d will fail because " + "start sequence number (%d) must not be larger than " + "snapshot end sequence number (%d)\n", partition, state.getStartSeqno(), state.getSnapshotEndSeqno()); } } }); } catch (IOException e) { System.out.println("Failed to decode " + sessionStatePath + ": " + e); } } }
From source file:com.sazneo.export.formatter.Main.java
public static void main(String... args) { Log logger = LogFactory.getLog(Main.class); if (args.length != 3) { logger.error("Usage: java Main <stylesheet> <export xml file> <output dir>"); System.exit(1); }// w w w. ja v a 2s . co m String styleSheetPath = args[0]; File styleSheet = new File(styleSheetPath); String exportXmlPath = args[1]; File exportXml = new File(exportXmlPath); String outPutDirPath = args[2]; File outputDir = new File(outPutDirPath); if (!outputDir.exists()) { outputDir.mkdirs(); } try { File outputFile = new File(outputDir, "export.html"); FileOutputStream outputStream = new FileOutputStream(outputFile); HtmlFormatter formatter = new HtmlFormatter(styleSheet, exportXml, outputStream); formatter.transform(); FileProcessor fileProcessor = new FileProcessor(exportXml, outputDir); fileProcessor.process(); } catch (IOException e) { logger.error(MessageFormat.format("Failed to create export.html at {0}:\n {1}", outPutDirPath, e)); } }
From source file:org.kuali.student.git.tools.Main.java
/** * @param args/* www. ja va 2 s . c o m*/ */ public static void main(String[] args) { if (args.length != 2) { log.error("USAGE: <path to git repository> <data file>"); System.exit(-1); } String pathToGitRepo = args[0]; String comparisonTagDataFile = args[1]; try { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( "git/applicationContext.xml"); applicationContext.registerShutdownHook(); GitExtractor extractor = applicationContext.getBean(GitExtractor.class); extractor.buildRepository(new File(pathToGitRepo)); List<String> pathsToCompare = FileUtils.readLines(new File(comparisonTagDataFile), "UTF-8"); for (String comparisonPath : pathsToCompare) { if (comparisonPath.trim().length() == 0 || comparisonPath.trim().startsWith("#")) continue; // skip empty lines and comments String parts[] = comparisonPath.split(":"); String targetTag = parts[0]; String copyFromTag = parts[1]; extractor.extractDifference(targetTag, copyFromTag); } } catch (Exception e) { log.error("Unexpected Exception", e); } }
From source file:org.powertac.samplebroker.core.BrokerMain.java
/** * Sets up the broker. Single command-line arg is the username *//*from w w w . ja va 2s . c o m*/ public static void main(String[] args) { BrokerRunner runner = new BrokerRunner(); runner.processCmdLine(args); // if we get here, it's time to exit System.exit(0); }
From source file:GridBagWithGridWidthHeight.java
public static void main(String[] args) { JFrame f = new JFrame("Demonstrates the use of gridwidth, gridheight constraints"); JPanel p = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 2, 2, 2); c.weighty = 1.0;//from w ww . java 2s . c om c.weightx = 1.0; c.gridx = 0; c.gridy = 0; c.gridheight = 2; // span across 2 rows p.add(new JButton("Java"), c); c.gridx = 1; c.gridheight = 1; // set back to 1 row c.gridwidth = 2; // span across 2 columns p.add(new JButton("Source"), c); c.gridy = 1; c.gridwidth = 1; // set back to 1 column p.add(new JButton("and"), c); c.gridx = 2; p.add(new JButton("Support."), c); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; f.addWindowListener(wndCloser); f.getContentPane().add(p); f.setSize(600, 200); f.show(); }
From source file:net.sf.janos.Janos.java
/** * @param args//from w w w . j ava 2 s . c om * @throws Exception */ public static void main(String[] args) { if (args.length > 1) { System.out.println("Usage: Janos [port]"); System.exit(1); } if (args.length == 1) { System.setProperty("net.sbbi.upnp.Discovery.bindPort", args[0]); } /* * [DW] For some reason unknown to me, given: * 1) arch is intel * 2) os is Mac OS X * 3) running in eclipse * 4) using SWT * no exceptions are displayed in the eclipse console in the main thread. * To work around this, we just do everything in a new thread :-) */ if (Boolean.getBoolean("net.sf.janos.forkNewThread")) { try { Thread mainThread = new Thread(new Janos(), "Janos-SWT"); mainThread.start(); mainThread.join(); } catch (Throwable t) { LogFactory.getLog(Janos.class).fatal("Could not start thread: ", t); System.exit(1); } } else { new Janos().run(); } }
From source file:LineDemo2D.java
public static void main(String s[]) { JFrame f = new JFrame("ShapesDemo2D"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }/*from ww w . j ava 2 s . co m*/ }); JApplet applet = new LineDemo2D(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(300, 300)); f.show(); }
From source file:com.precioustech.fxtrading.tradingbot.FXTradingBot.java
@SuppressWarnings("resource") public static void main(String[] args) { if (args.length == 0) { LOG.fatal("Usage: FxTradingBot <Implementation Config FileName>"); System.exit(1); }// ww w . j a v a2 s .c om ApplicationContext appContext = new ClassPathXmlApplicationContext("tradingbot-app.xml", args[0]); MarketDataStreamingService marketDataStreamingService = appContext .getBean(MarketDataStreamingService.class); marketDataStreamingService.startMarketDataStreaming(); EventsStreamingService eventStreamingService = appContext.getBean(EventsStreamingService.class); eventStreamingService.startEventsStreaming(); }
From source file:org.nekorp.workflow.desktop.control.MainClass.java
public static void main(String arg[]) { try {/* w ww . j a va2 s . c om*/ ApplicationContext ctx = new ClassPathXmlApplicationContext("spring/applicationContext.xml"); ctx.getBean(WorkflowApp.class).startAplicacion(); } catch (Exception e) { MainClass.LOGGER.error("No se logro inicializar la aplicacion", e); System.exit(1); } }
From source file:poc.telnet.TelnetServer.java
public static void main(String[] args) throws Exception { new ClassPathXmlApplicationContext("/META-INF/spring/integration/telnet-inbound.xml"); System.out.println("Press Enter/Return in the console to exit"); System.in.read();// w w w.j a va 2 s . co m System.exit(0); }