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 {//from w w w .  ja va  2s. c o  m
        Class<?> clazz = Class.forName("X");
        X x = (X) clazz.newInstance();
        Class[] argTypes = { String.class };
        Method method = clazz.getMethod("objectMethod", argTypes);
        Annotation[] annos = method.getAnnotations();
        for (Annotation anno : annos) {
            System.out.println(anno);
        }
        System.out.println();

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

From source file:TransformImagePDF.java

public static void main(String[] args) {
    Document.compress = false;//from  ww  w.ja  v  a 2s . c  o m
    Document document = new Document(PageSize.A4);
    try {
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("TransformImagePDF.pdf"));
        document.open();

        PdfContentByte cb = writer.getDirectContent();
        Image img = Image.getInstance("logo.png");
        cb.addImage(img, 250, -50, -30, 550, 100, 100);

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

From source file:DynaBeansExampleV3.java

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

    Connection conn = getConnection();
    PreparedStatement ps = conn/*from w w w  .j  av a  2  s  .c o m*/
            .prepareStatement("SELECT * from movie, person " + "WHERE movie.director = person.Id");
    ResultSet rs = ps.executeQuery();

    RowSetDynaClass rsdc = new RowSetDynaClass(rs);

    conn.close();

    Iterator itr = rsdc.getRows().iterator();
    while (itr.hasNext()) {
        DynaBean bean = (DynaBean) itr.next();
        System.err.println(bean.get("title"));
    }

}

From source file:X.java

public static void main(String[] args) {
    try {/* w ww  .ja  v a 2s .  c o  m*/
        Class<?> clazz = Class.forName("X");
        X x = (X) clazz.newInstance();
        Class[] argTypes = { String.class };
        Method method = clazz.getMethod("objectMethod", argTypes);
        Object[] data = { "Hello" };
        method.invoke(x, data); // Output: Instance method: Hello
        method = clazz.getMethod("classMethod", (Class<?>[]) null);
        method.invoke(null, (Object[]) null); // Output: Class method
    } catch (Exception e) {
        System.err.println(e);
    }
}

From source file:UsingUnicodePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*w  w  w  .  j  ava2 s . c  o m*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("UsingUnicodePDF.pdf"));
        document.open();

        document.add(new Phrase("\u0161"));
        document.add(new Phrase("\u0178"));
        document.add(new Phrase("\u017D"));
        document.add(new Phrase("\u017E"));

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

From source file:ChunksTextRiseUnderLinePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from   w  ww.j a  v  a2 s. c o  m*/
        PdfWriter.getInstance(document, new FileOutputStream("ChunksTextRiseUnderLinePDF.pdf"));
        document.open();

        Chunk test = new Chunk("some text");
        float subscript = -8.0f;
        test.setTextRise(subscript);
        test.setUnderline(new Color(0xFF, 0x00, 0x00), 3.0f, 0.0f, -5.0f + subscript, 0.0f,
                PdfContentByte.LINE_CAP_ROUND);

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

From source file:ChunksFontBackgroundPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from   w  ww.j a va 2  s.  c o m
        PdfWriter.getInstance(document, new FileOutputStream("ChunksFontBackgroundPDF.pdf"));
        document.open();

        Chunk test = new Chunk("some text");
        float superscript = 8.0f;
        test.setTextRise(superscript);
        test.setBackground(new Color(0xFF, 0xDE, 0xAD));
        test.setAnchor("http://www.java2s.com");
        test.setAnchor(new URL("http://www.java2s.com"));
        document.add(test);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:ChunkWidthPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from w  ww  .ja va2s. c o  m
        PdfWriter.getInstance(document, new FileOutputStream("ChunkWidthPDF.pdf"));
        document.open();

        Chunk c = new Chunk("Text Text Text Text Text Text Text Text Text Text");
        float w = c.getWidthPoint();
        System.out.println(
                "The width of the chunk: is " + String.valueOf(w) + " points or " + w / 72f + " inches.");
        document.add(c);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:MulticastSender.java

public static void main(String[] args) {

    InetAddress ia = null;/* w  w w  .  j ava2  s.com*/
    int port = 0;
    String characters = "Here's some multicast data\n";
    byte[] data = new byte[characters.length()];

    // read the address from the command line
    try {
        try {
            ia = InetAddress.getByName(args[0]);
        } catch (UnknownHostException e) {
            //ia = InetAddressFactory.newInetAddress(args[0]);
        }
        port = Integer.parseInt(args[1]);
    } catch (Exception e) {
        System.err.println(e);
        System.err.println("Usage: java MulticastSender MulticastAddress port");
        System.exit(1);
    }

    characters.getBytes(0, characters.length(), data, 0);
    DatagramPacket dp = new DatagramPacket(data, data.length, ia, port);

    try {
        MulticastSocket ms = new MulticastSocket();
        ms.joinGroup(ia);
        for (int i = 1; i < 10; i++) {
            ms.send(dp, (byte) 1);
        }
        ms.leaveGroup(ia);
        ms.close();
    } catch (SocketException se) {
        System.err.println(se);
    } catch (IOException ie) {
        System.err.println(ie);
    }

}

From source file:SettingPageSizeLETTER.java

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