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

public static void main(String[] args) {
    try {// ww w. j  a v a 2 s . com
        Class<?> clazz = Class.forName("X");
        X x = (X) clazz.newInstance();
        Class[] argTypes = { String.class };
        Method method = clazz.getMethod("objectMethod", argTypes);
        Class<?>[] exp = method.getExceptionTypes();
        for (Class anno : exp) {
            System.out.println(anno);
        }
        System.out.println();

    } catch (Exception e) {
        System.err.println(e);
    }
}

From source file:UsingRegisterFontPDF.java

public static void main(String[] args) {
    FontFactory.register("c:\\windows\\fonts\\comicbd.ttf");

    Document document = new Document();
    try {//from   ww  w . j a  va  2 s .c o  m
        PdfWriter.getInstance(document, new FileOutputStream("UsingRegisterFontPDF.pdf"));
        document.open();

        Font font1 = FontFactory.getFont("ComicSansMS", BaseFont.WINANSI, 12);
        String text1 = "True Type font 'ComicSansMS'.";
        document.add(new Paragraph(text1, font1));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();

}

From source file:SettingPageSizeA1.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  ww  w .  j a va2s  .  c o  m
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeA1.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A1);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN A1."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeA8.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from   w w w  .java 2s .  co m
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeA8.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A8);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN A8."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeA7.java

public static void main(String[] args) {
    Document document = new Document();
    try {/* w  ww  .  j a va  2  s.  co  m*/
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeA7.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A7);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN A7."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeA5.java

public static void main(String[] args) {
    Document document = new Document();
    try {// w ww  .  j  av  a 2  s.co  m
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeA5.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A5);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN A5."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeB0.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from   ww  w.ja  v  a 2 s. com*/
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeB0.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.B0);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN B0."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:Main.java

public static void main(String[] args) {

    for (int i = 0; i < args.length; i++) {
        if (args[i].toLowerCase().endsWith(".dfl")) {
            try {
                FileInputStream fin = new FileInputStream(args[i]);
                InflaterInputStream iis = new InflaterInputStream(fin);
                FileOutputStream fout = new FileOutputStream(args[i].substring(0, args[i].length() - 4));
                for (int c = iis.read(); c != -1; c = iis.read()) {
                    fout.write(c);//from   w  w  w  . j  av a  2  s.c o m
                }
                fout.close();
            } catch (IOException ex) {
                System.err.println(ex);
            }
        } else {
            System.err.println(args[i] + " does not appear to be a deflated file.");
        }
    }
}

From source file:NameLister.java

public static void main(String args[]) {

    if (args.length != 1) {
        System.err.println("Usage: java NameLister xmlfile.xml");
        System.exit(-1);/*from   www .j  a v a  2s .  co  m*/
    }

    try {

        SAXParserFactory factory = SAXParserFactory.newInstance();
        SAXParser saxParser = factory.newSAXParser();

        DefaultHandler handler = new DefaultHandler() {
            boolean name = false;

            public void startElement(String uri, String localName, String qName, Attributes attributes)
                    throws SAXException {
                if (qName.equalsIgnoreCase("NAME")) {
                    name = true;
                }
            }

            public void characters(char ch[], int start, int length) throws SAXException {
                if (name) {
                    System.out.println("Name: " + new String(ch, start, length));
                    name = false;
                }
            }
        };

        saxParser.parse(args[0], handler);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ImageRotatingPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  w ww  . ja  va  2  s. com*/
        PdfWriter.getInstance(document, new FileOutputStream("ImageRotatingPDF.pdf"));
        document.open();

        Image jpg = Image.getInstance("logo.png");
        jpg.setAlignment(Image.MIDDLE);

        jpg.setRotation((float) Math.PI / 6);
        document.add(new Paragraph("rotate 30 degrees"));
        document.add(jpg);
        document.newPage();

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}