List of usage examples for java.lang System exit
public static void exit(int status)
From source file:FilledRectangleDemo2D.java
public static void main(String s[]) { JFrame f = new JFrame(""); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }/* www .j av a 2 s . com*/ }); JApplet applet = new FilledRectangleDemo2D(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(300, 300)); f.show(); }
From source file:GridLayoutPane.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }//www . j av a2 s . c om }); frame.getContentPane().add(new GridLayoutPane(), BorderLayout.CENTER); // Finally, set the size of the main window, and pop it up. frame.setSize(600, 400); frame.setVisible(true); }
From source file:com.nokia.dempsy.spring.RunAppInVm.java
public static void main(String[] args) { try {// w w w. j a va 2 s . co m run(args); } catch (Throwable e) { e.printStackTrace(System.err); System.err.flush(); System.exit(1); } System.exit(0); }
From source file:EllipseDemo2D.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 av a 2 s .c o m*/ }); JApplet applet = new EllipseDemo2D(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(300, 300)); f.show(); }
From source file:ai.emot.demo.EmotAIDemo.java
public static void main(String[] args) throws IOException, InterruptedException { if (args.length != 2) { printUsage();// w w w . j av a2s . c o m System.exit(0); } String emotAIAPIBaseUrl = args[0]; String accessToken = args[1]; PathMatchingResourcePatternResolver fileResolver = new PathMatchingResourcePatternResolver( EmotAIDemo.class.getClassLoader()); Resource[] resources = fileResolver.getResources("images"); File dir = resources[0].getFile(); File imagesDir = new File(dir, "/face/cropped"); EmotAI emotAI = new EmotAITemplate(emotAIAPIBaseUrl, accessToken); // Create a display for the images ImageDisplay<Long> imageDisplay = new ImageDisplay<Long>(250, 250); for (File imageFile : imagesDir.listFiles(new JpegFileFilter())) { // Read each image BufferedImage image = ImageIO.read(imageFile); // Get the emotion profile for each image EmotionProfile emotionProfile = emotAI.emotionOperations().getFaceImageEmotionProfile(image); // Output emotion, and display image System.out.println(imageFile.getName() + " : " + emotionProfile); imageDisplay.onFrameUpdate(new SerializableBufferedImageAdapter(image), 1l); // Sleep for 1 second Thread.sleep(1000); } System.exit(1); }
From source file:org.camunda.bpm.RestDeployment.java
public static void main(String[] args) throws IOException { if (args.length == 0) { System.err.println("No process files specified"); System.exit(1); }/*from w w w . j a v a 2 s .co m*/ CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost("http://localhost:8080/engine-rest/deployment/create"); StringBody deploymentName = new StringBody("myDeployment", ContentType.TEXT_PLAIN); StringBody enableDuplicateFiltering = new StringBody("true", ContentType.TEXT_PLAIN); StringBody deployChangedOnly = new StringBody("true", ContentType.TEXT_PLAIN); MultipartEntityBuilder builder = MultipartEntityBuilder.create().addPart("deployment-name", deploymentName) .addPart("enable-duplicate-filtering", enableDuplicateFiltering) .addPart("deploy-changed-only", deployChangedOnly); for (String resource : args) { File resourceFile = new File(resource); FileBody fileBody = new FileBody(resourceFile); builder.addPart(resourceFile.getName(), fileBody); } HttpEntity httpEntity = builder.build(); httpPost.setEntity(httpEntity); HttpResponse response = httpClient.execute(httpPost); logResponse(response); }
From source file:RectangleDemo2D.java
public static void main(String s[]) { JFrame f = new JFrame(""); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }//ww w .ja va 2s.co m }); JApplet applet = new RectangleDemo2D(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(300, 300)); f.show(); }
From source file:com.manning.blogapps.chapter10.examples.AuthPostJava.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); }//from ww w.ja v a 2 s . c o m String credentials = args[0] + ":" + args[1]; String filepath = args[2]; URL url = new URL(args[3]); URLConnection conn = url.openConnection(); conn.setDoOutput(true); conn.setRequestProperty("Authorization", "Basic " + new String(Base64.encodeBase64(credentials.getBytes()))); File upload = new File(filepath); conn.setRequestProperty("name", upload.getName()); String contentType = "application/atom+xml; charset=utf8"; if (filepath.endsWith(".gif")) contentType = "image/gif"; else if (filepath.endsWith(".jpg")) contentType = "image/jpg"; conn.setRequestProperty("Content-type", contentType); BufferedInputStream filein = new BufferedInputStream(new FileInputStream(upload)); BufferedOutputStream out = new BufferedOutputStream(conn.getOutputStream()); byte buffer[] = new byte[8192]; for (int count = 0; count != -1;) { count = filein.read(buffer, 0, 8192); if (count != -1) out.write(buffer, 0, count); } filein.close(); out.close(); String s = null; BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((s = in.readLine()) != null) { System.out.println(s); } }
From source file:ArcDemo2D.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 av a 2s. c om*/ }); JApplet applet = new ArcDemo2D(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(300, 300)); f.show(); }
From source file:uk.ac.ebi.ep.sitemap.main.SiteMapMain.java
public static void main(String... args) throws Exception { //////////////comment here /////////////////////// // args = new String[4]; // //String dbConfig = "ep-mm-db-enzdev"; // //String dbConfig = "ep-mm-db-enzprel"; // String userHome = System.getProperty("user.home"); // String filename = "SiteMap"; // String testing = "true"; // //from ww w .ja v a 2 s.com // // args[0] = "vezpdev"; // args[1] = userHome; // args[2] = filename; // args[3] = testing; //////////////uncomment for testing parameters only /////////////////////// if (args == null) { System.out.println("Please provide required parameters"); System.exit(0); } AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.getEnvironment().setActiveProfiles(args[0]); context.scan("uk.ac.ebi.ep.data.dataconfig"); context.refresh(); UniprotEntryService service = context.getBean(UniprotEntryService.class); SiteMapGenerator siteMapGenerator = new EnzymePortalSiteMap(service); boolean testMode = Boolean.parseBoolean(args[3]); siteMapGenerator.generateSitemap(args[1], args[2], testMode); }