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:Main.java

public static void main(String[] args) {

    System.exit(0);
}

From source file:MainClass.java

public static void main(String[] a) {
    System.exit(0);
}

From source file:Main.java

public static void main(String[] args) {

    System.exit(0);

}

From source file:Main.java

public static void main(String[] args) {
    System.out.println("exit...");
    System.exit(0);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    InetAddress address = null;//from www . j ava2 s. c  om
    if (args.length == 0) {
        System.out.println("usage: GetIP host");
        System.exit(1);
    }

    address = InetAddress.getByName(args[0]);
    System.out.println(address.getHostName() + "=" + address.getHostAddress());
    System.exit(0);
}

From source file:SystemApp.java

public static void main(String args[]) {
    long time = System.currentTimeMillis();
    System.out.println(time);/* ww  w .j  av a2s . com*/
    Properties p = System.getProperties();
    p.list(System.out);
    System.exit(13);
}

From source file:JarRead.java

public static void main(String args[]) throws IOException {
    if (args.length != 2) {
        System.out.println("Please provide a JAR filename and file to read");
        System.exit(-1);
    }/*from  w w w.j a va  2s.  com*/
    JarFile jarFile = new JarFile(args[0]);
    JarEntry entry = jarFile.getJarEntry(args[1]);
    InputStream input = jarFile.getInputStream(entry);
    process(input);
    jarFile.close();
}

From source file:Main.java

public static void main(String[] args) throws IOException {
    Console cons = System.console();
    if (cons == null) {
        System.out.println("Console is null");
        System.exit(-1);
    } else {/*from  w  w  w.jav a2 s . com*/
        System.out.println("Enter text, or \"z\" to exit:");
        while (true) {
            char c = (char) cons.reader().read();
            System.out.println("" + c);
            if (c == 'z') {
                System.exit(0);
            }
        }
    }
}

From source file:Main.java

public static void main(String[] args) {
    Console console = System.console();

    if (console == null) {
        System.out.println("Console is not available");
        System.exit(1);
    }/*w  w  w. j av a 2  s  .c o m*/

    char[] password = "java2s.com".toCharArray();

    char[] passwordEntered = console.readPassword("Enter password: ");

    if (Arrays.equals(password, passwordEntered)) {
        System.out.println("\n Access granted \n");
        Arrays.fill(password, ' ');
        Arrays.fill(passwordEntered, ' ');
        System.out.println("OK ...");
    } else {
        System.out.println("Access denied");
        System.exit(1);
    }
}

From source file:MainClass.java

public static void main(String[] args) {
    if (args.length < 2) {
        System.out.println("Usage:\n" + "java MainClass " + "characterSequence regularExpression+");
        System.exit(0);
    }//from  w  ww  .  ja  v a 2  s .c  o m
    System.out.println("Input: \"" + args[0] + "\"");
    for (int i = 1; i < args.length; i++) {
        System.out.println("Regular expression: \"" + args[i] + "\"");
        Pattern p = Pattern.compile(args[i]);
        Matcher m = p.matcher(args[0]);
        while (m.find()) {
            System.out.println("Match \"" + m.group() + "\" at positions " + m.start() + "-" + (m.end() - 1));
        }
    }
}