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 {

    Path path = Paths.get("C:/tutorial/Java/JavaFX", "Topic.txt");

    //extract a single attribute with getAttribute
    try {//from  w w w  .j  a  v a2 s .c o  m
        long size = (Long) Files.getAttribute(path, "basic:size", java.nio.file.LinkOption.NOFOLLOW_LINKS);
        System.out.println("Size: " + size);
    } catch (IOException e) {
        System.err.println(e);
    }

}

From source file:Main.java

public static void main(String[] args) {

    Path newdir_1 = FileSystems.getDefault().getPath("C:/tutorial/Java/2010/");

    try {/* w w w  .  j  a  v  a  2s .  c  o  m*/
        Files.createDirectory(newdir_1);
    } catch (IOException e) {
        System.err.println(e);
    }
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));

    document.open();/*from   ww  w.  j a v  a 2 s . c o m*/
    BaseFont bf = BaseFont.createFont("esl_gothic_shavian.otf", "Cp1252", BaseFont.EMBEDDED);
    System.err.println(bf.getClass().getName());
    Font font = new Font(bf, 12);
    document.add(new Paragraph("abced"));
    document.add(new Paragraph("this is a test", font));
    document.close();
}

From source file:MainClass.java

public static void main(String args[]) {
    String name = "http://urlWithClassName";
    try {/*w w w  .ja va2s  . co m*/
        if (!name.endsWith(".class")) {
            System.err.println("That doesn't look like a byte code file!");
            return;
        }
        URL u = new URL(name);
        URLClassLoader ucl = new URLClassLoader(u);

        // parse out the name of the class from the URL
        String s = u.getFile();
        String classname = s.substring(s.lastIndexOf('/'), s.lastIndexOf(".class"));
        Class AppletClass = ucl.loadClass(classname, true);
        Applet apl = (Applet) AppletClass.newInstance();
        JFrame f = new JFrame();
        f.setSize(200, 200);
        f.add("Center", apl);
        apl.init();
        apl.start();
        f.setVisible(true);
    } catch (Exception e) {
        System.err.println(e);
    }
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));

    document.open();/*ww w .  ja  v a2 s  . co m*/
    BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED);
    System.err.println(bf.getClass().getName());
    Font font = new Font(bf, 12);
    document.add(new Paragraph("0123456789\nabcdefghijklmnopqrstuvwxyz\nABCDEFGHIJKLMNOPQRSTUVWXZ", font));
    document.close();
}

From source file:URLEquality.java

public static void main(String args[]) {

    try {//  www .  jav a 2  s .c  o m
        URL sunsite = new URL("http://www.java2s.com");
        URL helios = new URL("http://www.demo2s.com");
        if (sunsite.equals(helios)) {
            System.out.println(sunsite + " is the same as " + helios);
        } else {
            System.out.println(sunsite + " is not the same as " + helios);
        }
    } catch (MalformedURLException e) {
        System.err.println(e);
    }

}

From source file:Main.java

public static void main(String[] args) {

    Path copy_from_4 = Paths.get("C:/tutorial/Java/JavaFX", "tutor.txt");
    Path copy_to_4 = Paths.get("C:/tutorial/Java/Swing", "tutor.txt");
    try (OutputStream os = new FileOutputStream(copy_to_4.toFile())) {

        Files.copy(copy_from_4, os);

    } catch (IOException e) {
        System.err.println(e);
    }/*from w  ww .  j a  va2  s  .  c  o m*/

}

From source file:BeanUtilsCollectionsV2.java

 public static void main(String args[]) {
   BeanPredicate predicate =//from ww w  . java  2 s  . c o  m
     new BeanPredicate("title", PredicateUtils.uniquePredicate());

   Movie movie = new Movie();
   movie.setTitle("The Italian Job");

   Movie movie1 = new Movie();
   movie1.setTitle("The Italian Job");

   System.err.println(predicate.evaluate(movie)); // evaluates true
   System.err.println(predicate.evaluate(movie1)); // evaluates false

}

From source file:Main.java

public static void main(String[] args) throws Exception {
    if (args.length != 1) {
        System.err.println("usage: java TextReader " + "file location");
        System.exit(0);// ww w  . j a  v a 2s.  c  o m
    }
    readFile(args[0]);
}

From source file:lookForPorts.java

public static void main(String[] args) {

    Socket theSocket;//w w  w.j  a v a2 s  .co m
    String host = "localhost";

    if (args.length > 0) {
        host = args[0];
    }
    for (int i = 0; i < 1024; i++) {
        try {
            System.out.println("Looking for " + i);
            theSocket = new Socket(host, i);
            System.out.println("There is a server on port " + i + " of " + host);
        } catch (UnknownHostException e) {
            System.err.println(e);
            break;
        } catch (IOException e) {
            // must not be a server on this port
        }
    }
}