List of usage examples for java.lang System exit
public static void exit(int status)
From source file:PersisTest.java
public static void main(String args[]) { if (args.length == 0) { System.err.println("Usage: java PersisTest filename"); System.exit(-1); }//from w w w .j a va 2 s . co m new PersisTest(args[0]).show(); }
From source file:com.manning.blogapps.chapter10.examples.AuthDelete.java
public static void main(String[] args) throws Exception { if (args.length < 3) { System.out.println("USAGE: authdelete <username> <password> <url>"); System.exit(-1); }/*from w w w .j a v a2 s. c o m*/ String credentials = args[0] + ":" + args[1]; String url = args[2]; HttpClient httpClient = new HttpClient(); DeleteMethod method = new DeleteMethod(url); method.setRequestHeader("Authorization", "Basic " + new String(Base64.encodeBase64(credentials.getBytes()))); httpClient.executeMethod(method); System.out.println("Server returned status code: "); }
From source file:be_uclouvain_ingi2145_lab05.GiraphJobRunner.java
public static void main(String[] args) throws Exception { System.exit(ToolRunner.run(new GiraphJobRunner(), args)); }
From source file:AllAvailableFontsComboBox.java
public static void main(String s[]) { JFrame f = new JFrame("FontSelection"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }/* ww w. j a v a 2s . co m*/ }); AllAvailableFontsComboBox fontSelection = new AllAvailableFontsComboBox(); f.getContentPane().add(fontSelection, BorderLayout.CENTER); f.setSize(new Dimension(350, 250)); f.setVisible(true); }
From source file:DrawRectPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("DrawRect"); frame.setSize(300, 200);// w ww . ja v a2s . co m frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new DrawRectPanel()); frame.show(); }
From source file:Hib.View.java
public static void main(String[] args) throws MalformedURLException, JSONException { View view = new View(); boolean quit = false; while (!quit) { /*// w w w. j a va 2 s. c o m * Control of the program will flow through the Main Menu and the * sub menus. */ quit = view.main(); } System.exit(0); }
From source file:PopupMenu.java
public static void main(String[] args) { JFrame frame = new JFrame("JPopupMenu"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final Toolkit toolkit = frame.getToolkit(); final JPopupMenu menu = new JPopupMenu(); JMenuItem menuItemBeep = new JMenuItem("Beep"); menuItemBeep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { toolkit.beep();/*from ww w . ja v a 2 s . co m*/ } }); menu.add(menuItemBeep); JMenuItem menuItemClose = new JMenuItem("Close"); menuItemClose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); menu.add(menuItemClose); frame.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (e.getButton() == e.BUTTON3) { menu.show(e.getComponent(), e.getX(), e.getY()); } } }); frame.setSize(250, 200); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:MainClass.java
static public void main(String[] arg) { boolean validate = false; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(validate);//from www . j av a 2 s . co m dbf.setNamespaceAware(true); dbf.setIgnoringElementContentWhitespace(true); Document doc = null; try { DocumentBuilder builder = dbf.newDocumentBuilder(); doc = builder.parse(new InputSource(new StringReader(xmlString))); } catch (SAXException e) { System.exit(1); } catch (ParserConfigurationException e) { System.err.println(e); System.exit(1); } catch (IOException e) { System.err.println(e); System.exit(1); } TreeDumper td = new TreeDumper(); td.dump(doc); }
From source file:wiki.link.LinkImporter.java
public static void main(String[] args) { LinkImporter wr = new LinkImporter(); String path = null;//w w w . j a va 2s . co m for (int i = 0; i < args.length; i++) { if ("path".equals(args[i]) && i + 1 < args.length) { path = args[i + 1]; } } if (path == null) { System.out.println("Please specify the file path."); System.exit(1); } //wr.readXML("/mnt/dev/wiki/enwiki-20140203-pages-articles.xml"); wr.readXML(path); }
From source file:MulticastSniffer.java
public static void main(String[] args) { InetAddress ia = null;// www . j a v a 2 s.c o m byte[] buffer = new byte[65535]; DatagramPacket dp = new DatagramPacket(buffer, buffer.length); int port = 0; // read the address from the command line try { try { ia = InetAddress.getByName(args[0]); } catch (UnknownHostException e) { System.err.println(e); } port = Integer.parseInt(args[1]); } catch (Exception e) { System.err.println(e); System.err.println("Usage: java MulticastSniffer mcast-addr port"); System.exit(1); } System.out.println("About to join " + ia); try { MulticastSocket ms = new MulticastSocket(port); ms.joinGroup(ia); while (true) { System.out.println("About to receive..."); ms.receive(dp); String s = new String(dp.getData(), 0, 0, dp.getLength()); System.out.println(s); } } catch (SocketException se) { System.err.println(se); } catch (IOException ie) { System.err.println(ie); } }