List of usage examples for java.lang System exit
public static void exit(int status)
From source file:com.splunk.shuttl.testutil.ClassWithExternalDependencies.java
public static void main(String[] args) { new ClientProtocolException(); System.exit(ShellClassRunnerTest.EXIT_CODE); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("JFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); JButton counterButton = new JButton("Clicked #0"); JButton closeButton = new JButton("Close"); frame.setLayout(new FlowLayout()); contentPane.add(closeButton);//from w w w .java 2s . com contentPane.add(counterButton); counterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { counterButton.setText("Clicked #" + counter++); } }); closeButton.addActionListener(e -> System.exit(0)); frame.pack(); frame.setVisible(true); }
From source file:XORPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("XOR"); frame.setSize(300, 200);/* w w w . j a va2 s. co m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new XORPanel()); frame.show(); }
From source file:DashedStrokeDemo.java
public static void main(String s[]) { JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }/*from ww w .jav a 2 s . c o m*/ }); DashedStrokeDemo p = new DashedStrokeDemo(); f.getContentPane().add("Center", p); p.init(); f.pack(); f.setSize(new Dimension(250, 250)); f.show(); }
From source file:MulticastSender.java
public static void main(String[] args) { InetAddress ia = null;/* ww w .jav a 2s . c o m*/ int port = 0; String characters = "Here's some multicast data\n"; byte[] data = new byte[characters.length()]; // read the address from the command line try { try { ia = InetAddress.getByName(args[0]); } catch (UnknownHostException e) { //ia = InetAddressFactory.newInetAddress(args[0]); } port = Integer.parseInt(args[1]); } catch (Exception e) { System.err.println(e); System.err.println("Usage: java MulticastSender MulticastAddress port"); System.exit(1); } characters.getBytes(0, characters.length(), data, 0); DatagramPacket dp = new DatagramPacket(data, data.length, ia, port); try { MulticastSocket ms = new MulticastSocket(); ms.joinGroup(ia); for (int i = 1; i < 10; i++) { ms.send(dp, (byte) 1); } ms.leaveGroup(ia); ms.close(); } catch (SocketException se) { System.err.println(se); } catch (IOException ie) { System.err.println(ie); } }
From source file:com.javadeobfuscator.deobfuscator.DeobfuscatorMain.java
public static void main(String[] args) { System.exit(run(args)); }
From source file:MainClass.java
public static void main(String args[]) { FileInputStream fIn;//from w w w. j av a2 s . co m FileOutputStream fOut; FileChannel fIChan, fOChan; long fSize; MappedByteBuffer mBuf; try { fIn = new FileInputStream(args[0]); fOut = new FileOutputStream(args[1]); fIChan = fIn.getChannel(); fOChan = fOut.getChannel(); fSize = fIChan.size(); mBuf = fIChan.map(FileChannel.MapMode.READ_ONLY, 0, fSize); fOChan.write(mBuf); // this copies the file fIChan.close(); fIn.close(); fOChan.close(); fOut.close(); } catch (IOException exc) { System.out.println(exc); System.exit(1); } catch (ArrayIndexOutOfBoundsException exc) { System.out.println("Usage: Copy from to"); System.exit(1); } }
From source file:HasBatteries.java
public static void main(String[] args) { Class c = null;//from w ww . j av a2 s . com try { c = Class.forName("FancyToy"); } catch (ClassNotFoundException e) { System.out.println("Can't find FancyToy"); System.exit(1); } printInfo(c); Class[] faces = c.getInterfaces(); for (int i = 0; i < faces.length; i++) printInfo(faces[i]); Class cy = c.getSuperclass(); Object o = null; try { // Requires default constructor: o = cy.newInstance(); // (*1*) } catch (InstantiationException e) { System.out.println("Cannot instantiate"); System.exit(1); } catch (IllegalAccessException e) { System.out.println("Cannot access"); System.exit(1); } printInfo(o.getClass()); }
From source file:Main.java
public static void main(String[] args) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(new Main()); if (job.printDialog()) { try {//from www .j a v a 2 s.c o m job.print(); } catch (PrinterException e) { } } System.exit(0); }
From source file:de.holger_oehm.pic.usb.ServoController.java
public static void main(final String[] args) throws IOException, ParseException { final int status = new CommandDispatcher(args).run(); System.exit(status); }