Example usage for java.lang System exit

List of usage examples for java.lang System exit

Introduction

In this page you can find the example usage for java.lang System exit.

Prototype

public static void exit(int status) 

Source Link

Document

Terminates the currently running Java Virtual Machine.

Usage

From source file:com.opengamma.bbg.config.BloombergSecurityTypeDefinitionTool.java

/**
 * Main method to run the tool./*from  w ww.  ja  va2s  .  co  m*/
 */
public static void main(String[] args) { // CSIGNORE
    new BloombergSecurityTypeDefinitionTool().initAndRun(args, ToolContext.class);
    System.exit(0);
}

From source file:abs.backend.erlang.ErlangBackend.java

public static void main(final String... args) {
    try {// w  w  w. j a  v  a2s  .  c om
        new ErlangBackend().compile(args);
    } catch (InternalBackendException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    } catch (NotImplementedYetException e) {
        System.err.println(e.getMessage());
        System.exit(0);
    } catch (Exception e) {
        System.err.println("An error occurred during compilation:\n" + e.getMessage());
        if (Arrays.asList(args).contains("-debug")) {
            e.printStackTrace();
        }
        System.exit(1);
    }
}

From source file:Main.java

public static void main(String args[]) throws Exception {
    String filename = args[0];//from   w  w  w.  java  2s.c o m
    DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
    PrintService printService = PrintServiceLookup.lookupDefaultPrintService();
    DocPrintJob job = printService.createPrintJob();
    PrintJobListener listener = new PrintJobAdapter() {
        public void printDataTransferCompleted(PrintJobEvent e) {
            System.out.println("Good-bye");
            System.exit(0);
        }
    };
    job.addPrintJobListener(listener);
    PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
    FileInputStream fis = new FileInputStream(filename);
    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc = new SimpleDoc(fis, flavor, das);
    job.print(doc, pras);
    Thread.sleep(10000);
}

From source file:com.manning.blogapps.chapter10.examples.AuthGet.java

public static void main(String[] args) throws Exception {
    if (args.length < 3) {
        System.out.println("USAGE: authget <username> <password> <url>");
        System.exit(-1);
    }//from  ww  w  . j a v  a  2  s.c o m
    String credentials = args[0] + ":" + args[1];
    String url = args[2];

    HttpClient httpClient = new HttpClient();
    GetMethod method = new GetMethod(url);
    method.setRequestHeader("Authorization",
            "Basic " + new String(Base64.encodeBase64(credentials.getBytes())));

    httpClient.executeMethod(method);
    System.out.println(method.getResponseBodyAsString());
}

From source file:AreaIntersect.java

public static void main(String s[]) {
    JFrame f = new JFrame("Pear");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }// ww  w . ja  v  a2  s.  c o m
    });
    JApplet applet = new AreaIntersect();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(150, 200));
    f.show();
}

From source file:DynamicHookupTest.java

public static void main(String[] args) {
    JFrame f = new DynamicHookupTest();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent we) {
            System.exit(0);
        }/* ww w  .ja v a 2 s.com*/
    });
    f.setSize(150, 150);
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("Customized Event");
    frame.setSize(300, 80);// w  w w  . j  av a  2 s.  c o m
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    Container contentPane = frame.getContentPane();
    contentPane.add(new Main());

    frame.setVisible(true);
}

From source file:Whois.java

public static void main(String[] args) {
    String hostname = "";
    String ulist = "";
    if (args.length == 0) {
        System.out.println("usage: whois [%host] query");
        System.exit(1);
    }//from w w  w  .  j  a  v a  2s  .co  m
    int argn = 0;
    hostname = "whois.networksolutions.com"; // default
    if (args.length > 1 && args[0].charAt(0) == '%') {
        hostname = args[argn].substring(1);
        argn++;
    }
    for (int i = argn; i < args.length; i++)
        ulist += args[i] + " ";
    Whois worker = new Whois();
    try {
        System.out.println(worker.whois(ulist.trim(), hostname));
    } catch (Exception e) {
        System.out.println(e);
    }
}

From source file:Delete.java

/**
 * This is the main() method of the standalone program. After checking it
 * arguments, it invokes the Delete.delete() method to do the deletion
 *///from   w  w  w .j av a 2s  . c o m
public static void main(String[] args) {
    if (args.length != 1) { // Check command-line arguments
        System.err.println("Usage: java Delete <file or directory>");
        System.exit(0);
    }
    // Call delete() and display any error messages it throws.
    try {
        delete(args[0]);
    } catch (IllegalArgumentException e) {
        System.err.println(e.getMessage());
    }
}

From source file:com.opengamma.integration.tool.marketdata.HtsSyncTool.java

/**
 * Main method to run the tool./*from ww  w .  j a va 2 s .c  o  m*/
 * No arguments are needed.
 * 
 * @param args  the arguments, unused
 */
public static void main(String[] args) { // CSIGNORE
    boolean success = new HtsSyncTool().initAndRun(args);
    System.exit(success ? 0 : 1);
}