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

public static void main(String[] args) throws Exception {

    FileOutputStream f = new FileOutputStream("file.txt");

    System.setErr(new PrintStream(f));

    System.err.println("This will get redirected to file from java2s.com");
}

From source file:MainClass.java

public static void main(String[] args) {
    try {//from w  w  w  .j  a va 2s  .  co m
        copy(System.in, System.out);
    } catch (IOException ex) {
        System.err.println(ex);
    }

}

From source file:MainClass.java

public static void main(String[] args) throws IOException {
    if (args.length != 1) {
        System.err.println("Usage: java FileTyper filename");
        return;/*  w w  w . j  ava  2  s . c o  m*/
    }
    typeFile(args[0]);
}

From source file:CharSetExampleV1.java

public static void main(String args[]) {
    CharSet set = CharSet.getInstance("the apprentice");
    System.err.println(set.contains('q'));
    CharRange[] range = set.getCharRanges();

    System.err.println(ArrayUtils.toString(range));
}

From source file:Main.java

public static void main(String[] args) {
    try {/*from   w w  w .jav a  2s  .c  o  m*/
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
        System.err.println("Look and feel not set.");
    }
    JFrame aWindow = new JFrame("This is the Window Title");
    aWindow.setBounds(50, 100, 300, 300);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    aWindow.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] args) {

    try {//from  w ww. ja v a2  s  .com
        InetAddress ia = InetAddress.getByName("64.21.29.37");
        System.out.println(ia.getHostName());
    } catch (Exception ex) {
        System.err.println(ex);
    }

}

From source file:NetUsage.java

public static void main(String args[]) {
    NetUsage codec = new NetUsage();
    try {//www  . j a  v  a2  s  .  com
        codec.start();
    } catch (Exception e) {
        System.err.println(e);
    }
}

From source file:Main.java

public static void main(String[] ap) {
    int val;
    try {//  www .  j a  v a 2s .c  o  m
        Scanner sc = new Scanner(System.in); // Requires J2SE 1.5
        val = sc.nextInt();
    } catch (NumberFormatException ex) {
        System.err.println("Not a valid number: " + ex);
        return;
    }
    System.out.println("I read this number: " + val);
}

From source file:Test.java

public static void main(String[] args) {
    Pattern p = Pattern.compile("([\\w\\s]+) word");
    Matcher m = p.matcher("Could you test a phrase with some word");
    while (m.find()) {
        System.err.println(m.group(1));
        System.err.println(m.group());
    }//from w  w w.j  a  v a 2s  .  co  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    System.setOut(new LogStream(System.out, new PrintStream(new FileOutputStream("out.log"))));
    System.setErr(new LogStream(System.err, new PrintStream(new FileOutputStream("err.log"))));

    System.out.println("output");
    System.err.println("error");
}