List of usage examples for java.lang System exit
public static void exit(int status)
From source file:com.manning.blogapps.chapter10.examples.AuthPost.java
public static void main(String[] args) throws Exception { if (args.length < 4) { System.out.println("USAGE: authpost <username> <password> <filepath> <url>"); System.exit(-1); }//w w w.j a va 2s.c om String credentials = args[0] + ":" + args[1]; String filepath = args[2]; String url = args[3]; HttpClient httpClient = new HttpClient(); EntityEnclosingMethod method = new PostMethod(url); method.setRequestHeader("Authorization", "Basic " + new String(Base64.encodeBase64(credentials.getBytes()))); File upload = new File(filepath); method.setRequestHeader("Title", upload.getName()); method.setRequestBody(new FileInputStream(upload)); String contentType = "application/atom+xml; charset=utf8"; if (filepath.endsWith(".gif")) contentType = "image/gif"; else if (filepath.endsWith(".jpg")) contentType = "image/jpg"; method.setRequestHeader("Content-type", contentType); httpClient.executeMethod(method); System.out.println(method.getResponseBodyAsString()); }
From source file:com.tikal.tallerWeb.control.MainClass.java
public static void main(String arg[]) { try {//from w w w . ja va 2 s. c o m ApplicationContext mini = new ClassPathXmlApplicationContext("spring/mini-appContext.xml"); StartupController startupApp = mini.getBean(StartupController.class); startupApp.startup(); } catch (Exception e) { MainClass.LOGGER.error("No se logro inicializar la aplicacion", e); System.exit(1); } }
From source file:BorderLayoutPane.java
public static void main(String[] a) { JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }/*from w w w .ja v a2s .c o m*/ }); f.setContentPane(new BorderLayoutPane()); f.pack(); f.setVisible(true); }
From source file:org.kuali.student.git.cleaner.RepositoryCleanerMain.java
/** * @param args/*w w w. j a v a2 s. co m*/ */ public static void main(String[] args) { if (args.length < 1) { log.error("USAGE: <module name> [module specific arguments]"); System.exit(-1); } try { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( "RepositoryCleanerMain-applicationContext.xml"); applicationContext.registerShutdownHook(); String beanName = args[0]; RepositoryCleaner repoCleaner = (RepositoryCleaner) applicationContext.getBean(beanName); /* * Exclude the module name from the args sent to the module. */ repoCleaner.validateArgs(Arrays.asList(args).subList(1, args.length)); repoCleaner.execute(); } catch (Exception e) { log.error("unexpected exception", e); } }
From source file:oobbit.Application.java
public static void main(String[] args) { try {/*from w w w . j a v a2s . c o m*/ Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ex) { System.out.println("You are missing the JDBC Driver (com.mysql.jdbc.Driver) " + "which is essential for this software to work. " + "Please make sure it's included pom.xml of this software."); System.exit(1); // Force quit (TODO?) } SpringApplication.run(Application.class, args); }
From source file:com.rdsic.pileconstructionmanagement.test.Test.java
public static void main(String[] args) { String sql = "select * from user"; List<Map<String, Object>> list = (ArrayList) GenericHql.INSTANCE.querySQL(sql, 20); if (!list.isEmpty()) { System.out.println("cnt:" + list.size()); JSONObject r = new JSONObject(); r.put("items", list); System.out.println(r.toString()); list.stream().map((item) -> { System.out.println("RECORD"); return item; }).forEach((item) -> {//from w w w . j a v a 2 s.c o m for (String k : item.keySet()) { JSONObject j = new JSONObject(item); System.out.println(j.toString()); System.out.println(StringUtils.rightPad(k, 20, " ") + item.get(k).toString()); } }); } System.exit(0); }
From source file:ColorPan.java
public static void main(String[] args) { JFrame f = new JFrame("ColorPan"); f.getContentPane().add(new ColorPan()); f.setSize(300, 300);//from w ww . j ava2s . co m f.setLocation(100, 100); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setVisible(true); }
From source file:FilledArc.java
public static void main(String s[]) { JFrame f = new JFrame(""); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }/*from w w w. j a v a 2 s . c o m*/ }); JApplet applet = new FilledArc(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(300, 300)); f.show(); }
From source file:org.mshariq.cxf.brave.Server.java
public static void main(String args[]) throws Exception { ApplicationContext appctxt = new ClassPathXmlApplicationContext( Server.class.getResource("/context.xml").toString()); System.out.println("Server ready..."); Thread.sleep(5 * 6000 * 1000); System.out.println("Server exiting"); System.exit(0); }
From source file:mosaicsimulation.MosaicLockstepServer.java
public static void main(String[] args) { Options opts = new Options(); opts.addOption("s", "serverPort", true, "Listening TCP port used to initiate handshakes"); opts.addOption("n", "nClients", true, "Number of clients that will participate in the session"); opts.addOption("t", "tickrate", true, "Number of transmission session to execute per second"); opts.addOption("m", "maxUDPPayloadLength", true, "Max number of bytes per UDP packet"); opts.addOption("c", "connectionTimeout", true, "Timeout for UDP connections"); DefaultParser parser = new DefaultParser(); CommandLine commandLine = null;/*from w w w. ja va 2s. c o m*/ try { commandLine = parser.parse(opts, args); } catch (ParseException ex) { ex.printStackTrace(); System.exit(1); } int serverPort = Integer.parseInt(commandLine.getOptionValue("serverPort")); int nClients = Integer.parseInt(commandLine.getOptionValue("nClients")); int tickrate = Integer.parseInt(commandLine.getOptionValue("tickrate")); int maxUDPPayloadLength = Integer.parseInt(commandLine.getOptionValue("maxUDPPayloadLength")); int connectionTimeout = Integer.parseInt(commandLine.getOptionValue("connectionTimeout")); Thread serverThread = LockstepServer.builder().clientsNumber(nClients).tcpPort(serverPort) .tickrate(tickrate).maxUDPPayloadLength(maxUDPPayloadLength).connectionTimeout(connectionTimeout) .build(); serverThread.setName("Main-server-thread"); serverThread.start(); try { serverThread.join(); } catch (InterruptedException ex) { LOG.error("Server interrupted while joining"); } }