Example usage for java.lang System err

List of usage examples for java.lang System err

Introduction

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

Prototype

PrintStream err

To view the source code for java.lang System err.

Click Source Link

Document

The "standard" error output stream.

Usage

From source file:HashMapExampleV1.java

public static void main(String args[]) {
    BidiMap agentToCode = new DualHashBidiMap();
    agentToCode.put("007", "Bond");
    agentToCode.put("006", "Trevelyan");
    agentToCode.put("002", "Fairbanks");

    System.err.println("Agent name from code: " + agentToCode.get("007"));
    System.err.println("Code from Agent name: " + agentToCode.getKey("Bond"));
}

From source file:MainClass.java

public static void main(String[] a) {
    File aFile = new File("C:/myFile.txt");
    FileInputStream inputFile = null;
    try {/*www . j  a va2s.  c o m*/
        inputFile = new FileInputStream(aFile);
    } catch (FileNotFoundException e) {
        e.printStackTrace(System.err);
        System.exit(1);
    }
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    ResourceBundle resources;//from   ww w.  ja v  a 2 s .c  o m

    try {
        resources = ResourceBundle.getBundle("MyData");
        System.out.println(resources.getString("Hi"));
    } catch (MissingResourceException mre) {
        System.err.println("MyData.properties not found");
    }
}

From source file:MainClass.java

public static void main(String args[]) {
    try {/*w  w  w  . ja v a  2 s  . c o m*/
        URL root = new URL("http://");
        saveBinaryFile(root);
    } catch (MalformedURLException e) {
        System.err.println("not URL I understand.");
    }
}

From source file:TrueTypeCollectionsPDF.java

public static void main(String[] args) {
    try {/*from   w w w.j a  va2  s .co  m*/
        String[] names = BaseFont.enumerateTTCNames("c:\\windows\\fonts\\msgothic.ttc");
        for (int i = 0; i < names.length; i++) {
            System.out.println("font " + i + ": " + names[i]);
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
}

From source file:FileCopy.java

public static void main(String[] args) {
    try {// www.j  av a  2s. c om
        copy("fromFile.txt", "toFile.txt");
    } catch (IOException e) {
        System.err.println(e.getMessage());
    }
}

From source file:Main.java

public static void main(String[] argv) {
    int number = 0;

    System.out.println("The number of words in argv is " + argv.length);

    if (argv.length == 0) {
        number = 1234;//  w  w w.jav  a2  s .c om
    } else if (argv.length == 1) {
        try {
            number = Integer.parseInt(argv[0]);
        } catch (NumberFormatException e) {
            System.err.println("Number " + argv[0] + " invalid (" + e.getMessage() + ").");
            System.exit(1);
        }
    } else {
        System.err.println("usage: UseArgv number");
        System.exit(1);
    }

    System.out.println("OK, number is " + number);
}

From source file:Main.java

public static void main(String[] args) {

    Path path = FileSystems.getDefault().getPath("C:/tutorial/photos", "Demo.jpg");

    //delete the  file
    try {/*  w w w .j  av  a  2  s.c  om*/
        Files.delete(path);
    } catch (IOException | SecurityException e) {
        System.err.println(e);
    }

}

From source file:MainClass.java

public static void main(String[] a) {
    File aFile = new File("charData.txt");
    FileInputStream inFile = null;
    try {// w w  w.j  av  a2s.  c o m
        inFile = new FileInputStream(aFile);
    } catch (FileNotFoundException e) {
        e.printStackTrace(System.err);
        System.exit(1);
    }
    FileChannel inChannel = inFile.getChannel();
}

From source file:MainClass.java

public static void main(String[] args) {

    String input = "http://www.java2s.com/query?pg=q&kl=XX&stype=stext&q=%2B%22Java+Programming%22&search.x=30&search.y=7";
    System.out.println(input);/*  w w w  . jav  a2 s . co  m*/
    try {
        String output = URLDecoder.decode(input, "UTF8");
        System.out.println(output);
    } catch (Exception e) {
        System.err.println("Malformed URL");
    }

}