List of usage examples for java.lang System exit
public static void exit(int status)
From source file:jongo.JongoJetty.java
public static void main(String[] args) throws Exception { l.debug("Load Jetty Configuration"); XmlConfiguration jettyConf = getJettyConfiguration(); if (jettyConf == null) { l.error("Failed to load Jetty Configuration. Quitting."); System.exit(1); }/*from www.j av a2 s .co m*/ Server server = (Server) jettyConf.configure(); l.info("Starting Jongo in Jetty Embedded mode"); server.start(); server.join(); }
From source file:FillPolyPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("FillPoly"); frame.setSize(300, 200);/* w w w . j a v a2s . c o m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new FillPolyPanel()); frame.show(); }
From source file:com.alacoder.lion.rpc.springsupport.DemoRpcClient.java
@SuppressWarnings({ "resource", "unused" }) public static void main(String[] args) throws InterruptedException { ApplicationContext applicationContext = new ClassPathXmlApplicationContext( new String[] { "classpath*:lion_demo_server.xml" }); System.out.println("server start..."); ApplicationContext ctx = new ClassPathXmlApplicationContext( new String[] { "classpath:lion_demo_client.xml" }); DemoService service = (DemoService) ctx.getBean("lionDemoReferer"); for (int i = 0; i < Integer.MAX_VALUE; i++) { System.out.println(service.hello("lion " + i)); Thread.sleep(1000);//from ww w . ja v a 2 s . c o m } System.out.println("lion demo is finish."); System.exit(0); }
From source file:net.jradius.server.Main.java
public static void main(String[] args) { if (args.length != 1) { showUsage();/*from w ww . j a v a2 s . co m*/ System.exit(1); } /** * CADBiS daemon run * ---> */ if (JRadiusConfigurator.getInstance().getProperty("cadbis_daemon").equals("enabled")) CADBiS.getInstance().start(); /** * <--- eof CADBiS */ String configFilePath = args[0]; try { File file = new File(configFilePath); Configuration.initialize(file); JRadiusServer server = new JRadiusServer(); server.start(); } catch (FileNotFoundException e) { System.err.println("Error: The configuration file '" + configFilePath + "' does not exist."); } catch (ConfigurationException e1) { System.err.println("Error: The configuration file could not be read," + " because the file contains an error: " + e1.getMessage()); showStackTrace(e1); } catch (SecurityException e2) { System.err.println("Error: The configuration file could not be read," + " because a security error occurred: " + e2.getMessage()); showStackTrace(e2); } catch (IllegalArgumentException e3) { System.err.println("Error: The configuration file could not be read," + " because an illegal argument error occurred: " + e3.getMessage()); showStackTrace(e3); } catch (ClassNotFoundException e4) { System.err.println("Error: The configuration file could not be read," + " because a class specified in the configuration file could not be found: " + e4.getMessage()); showStackTrace(e4); } catch (NoSuchMethodException e5) { System.err.println("Error: The configuration file could not be read," + " because a method does not exist in a class specified in the configuration file: " + e5.getMessage()); showStackTrace(e5); } catch (InstantiationException e6) { System.err.println("Error: The configuration file could not be read," + " because an object specified in the configuration file could not be instantiated: " + e6.getMessage()); showStackTrace(e6); } catch (IllegalAccessException e7) { System.err.println("Error: The configuration file could not be read," + " because an illegal access error occurred: " + e7.getMessage()); showStackTrace(e7); } catch (InvocationTargetException e8) { System.err.println("Error: The configuration file could not be read," + " because an invocation target exception was thrown: " + e8.getMessage()); showStackTrace(e8); } catch (Exception e) { e.printStackTrace(); } return; }
From source file:com.sundy.motan.client.AnnotationRpcClientDemo.java
public static void main(String[] args) throws InterruptedException { ApplicationContext ctx = new ClassPathXmlApplicationContext( new String[] { "classpath:motan_demo_client_annotation.xml" }); DemoRpcHandler handler = (DemoRpcHandler) ctx.getBean("demoRpcHandler"); handler.test();//w w w . j a v a 2 s .co m System.out.println("motan demo is finish."); System.exit(0); }
From source file:de.extra.client.crypto.ExtraPasswordEncryptor.java
public static void main(final String[] args) { final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-encryption.xml"); final StringEncryptor stringEncryptor = context.getBean("configurationEncryptor", StringEncryptor.class); if (args == null || args.length != 1) { System.err.println("Argument fehlt. Aufruf mit\nencrypt-password.bat <Passwort>"); System.exit(ReturnCode.TECHNICAL.getCode()); }/* ww w .j a v a 2 s .co m*/ System.out.println("ENC(" + stringEncryptor.encrypt(args[0]) + ")"); System.exit(ReturnCode.SUCCESS.getCode()); }
From source file:com.alertlogic.aws.analytics.poc.DeleteResources.java
public static void main(String[] args) { if (args.length != 4) { System.err.println("Usage: " + DeleteResources.class.getSimpleName() + " <application name> <stream name> <DynamoDB table name> <region>"); System.exit(1); }// w w w . ja va 2 s .c om String applicationName = args[0]; String streamName = args[1]; String countsTableName = args[2]; Region region = Utils.parseRegion(args[3]); AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain(); ClientConfiguration clientConfig = Utils.configureUserAgentForSample(new ClientConfiguration()); AmazonKinesis kinesis = new AmazonKinesisClient(credentialsProvider, clientConfig); kinesis.setRegion(region); AmazonDynamoDB dynamoDB = new AmazonDynamoDBClient(credentialsProvider, clientConfig); dynamoDB.setRegion(region); StreamUtils streamUtils = new StreamUtils(kinesis); DynamoDBUtils dynamoDBUtils = new DynamoDBUtils(dynamoDB); LOG.info("Removing Amazon Kinesis and DynamoDB resources used by the sample application..."); streamUtils.deleteStream(streamName); // The Kinesis Client Library creates a table to manage shard leases and uses the application name for its name. dynamoDBUtils.deleteTable(applicationName); dynamoDBUtils.deleteTable(countsTableName); }
From source file:ca.uqac.info.trace.TraceGenerator.java
public static void main(String[] args) { // Parse command line arguments Options options = setupOptions();//from w w w . j a va 2 s . c om CommandLine c_line = setupCommandLine(args, options); int verbosity = 0, max_events = 1000000; if (c_line.hasOption("h")) { showUsage(options); System.exit(ERR_OK); } String generator_name = "simplerandom"; if (c_line.hasOption("g")) { generator_name = c_line.getOptionValue("generator"); } long time_per_msg = 1000; if (c_line.hasOption("i")) { time_per_msg = Integer.parseInt(c_line.getOptionValue("i")); } if (c_line.hasOption("verbosity")) { verbosity = Integer.parseInt(c_line.getOptionValue("verbosity")); } if (c_line.hasOption("e")) { max_events = Integer.parseInt(c_line.getOptionValue("e")); } String feeder_params = ""; if (c_line.hasOption("parameters")) { feeder_params = c_line.getOptionValue("parameters"); } MessageFeeder mf = instantiateFeeder(generator_name, feeder_params); if (mf == null) { System.err.println("Unrecognized feeder name"); System.exit(ERR_ARGUMENTS); } // Trap Ctrl-C to send EOT before shutting down Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { char EOT = 4; System.out.print(EOT); } }); for (int num_events = 0; mf.hasNext() && num_events < max_events; num_events++) { long time_begin = System.nanoTime(); String message = mf.next(); StringBuilder out = new StringBuilder(); out.append(message); System.out.print(out.toString()); long time_end = System.nanoTime(); long duration = time_per_msg - (long) ((time_end - time_begin) / 1000000f); if (duration > 0) { try { Thread.sleep(duration); } catch (InterruptedException e) { } } if (verbosity > 0) { System.err.print("\r" + num_events + " " + duration + "/" + time_per_msg); } } }
From source file:de.haber.xmind2latex.Main.java
/** * Executes a {@link XMindToLatexExporter} with the given arguments. * /* w w w. ja v a 2s . c o m*/ * @param args configuration arguments. */ public static void main(String[] args) { try { XMindToLatexExporter tool = CliParameters.build(args); if (tool != null) { tool.convert(); } } catch (ParseException e) { System.err.println(e.getMessage()); CliParameters.showHelp(); System.exit(-1); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(-1); } }
From source file:edu.jhu.pha.vospace.node.NodePath.java
public static final void main(String[] s) { try {/* ww w. j a v a 2 s . co m*/ NodePath sres1 = new NodePath("/a/"); System.out.println(sres1.getParentRelativePath(new NodePath("/a/b/c"))); } catch (Exception ex) { ex.printStackTrace(); } System.exit(1); Vector<String> strs = new Vector<String>(); strs.add(""); strs.add("/"); strs.add("cont1"); strs.add("/cont1"); strs.add("/cont1/"); strs.add("/cont1/file1"); strs.add("cont1/file1"); strs.add("cont1/dir1/"); strs.add("cont1/dir1/file1"); strs.add("cont1/dir1/dir2/file1"); strs.add("cont1/dir1/dir2/dir3/"); for (String sss : strs) { try { NodePath sres1 = new NodePath(sss); System.out.println(sss + ": (" + sres1.getContainerName() + "|" + sres1.getNodeStoragePath() + "|" + sres1.getNodeOuterPath() + ");"); } catch (Exception ex) { ex.printStackTrace(); } } }