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

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

        Chunk c = new Chunk("background chunk");
        c.setBackground(new Color(0xFF, 0x00, 0x00), 5f, 30f, -10f, 0f);

        Paragraph p = new Paragraph("The following chunk is ");
        p.add(c);
        document.add(p);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:TrueTypeFromTTFFilePDF.java

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

        BaseFont bfComic = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf", BaseFont.CP1252,
                BaseFont.NOT_EMBEDDED);
        Font font = new Font(bfComic, 12);
        String text1 = "arial.ttf";
        document.add(new Paragraph(text1, font));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:TestDSLookUp.java

public static void main(String[] args) throws SQLException, NamingException {

    Context ctx = null;//from w  w  w. j  a va 2  s . c  o m
    try {
        Properties prop = new Properties();
        prop.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
        prop.setProperty(Context.PROVIDER_URL, "file:/JNDI/JDBC");
        ctx = new InitialContext(prop);
    } catch (NamingException ne) {
        System.err.println(ne.getMessage());
    }

    DataSource ds = (DataSource) ctx.lookup("joe");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery(
            "select 'Hello Thin driver data source tester '||" + "initcap(USER)||'!' result from dual");
    if (rset.next())
        System.out.println(rset.getString(1));
    rset.close();
    stmt.close();
    conn.close();
}

From source file:AddingAWTImageColorPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  w ww . ja v  a 2 s.  c o  m*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("AddingAWTImageColorPDF.pdf"));
        document.open();
        PdfContentByte cb = writer.getDirectContent();

        java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage("logo.png");

        Image image = Image.getInstance(awtImage, new Color(0x00, 0x00, 0xFF), true);
        image.setAbsolutePosition(100, 500);
        cb.addImage(image);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:TableCellColorPDF.java

public static void main(String[] args) {
    Document document = new Document();

    try {//w  w  w .  j  a  v  a  2 s  .c om
        PdfWriter.getInstance(document, new FileOutputStream("TableCellColorPDF.pdf"));
        document.open();

        PdfPTable table = new PdfPTable(1);
        PdfPCell cell = new PdfPCell(new Paragraph("cell test1"));
        cell.setBorderColor(new Color(255, 0, 0));
        table.addCell(cell);

        cell = new PdfPCell(new Paragraph("cell test2"));
        table.addCell(cell);

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

From source file:MainClass.java

public static void main(String args[]) {

    URL webURL, ftpURL;//  w  w w. ja v  a2 s. co  m

    try {
        webURL = new URL("http://www.macfaq.com/vendor.html");
        System.out.println(webURL);
        ftpURL = new URL("ftp://ftp.macfaq.com/pub/");
        System.out.println(ftpURL);

        webURL = new URL("http", "www.macfaq.com", "/vendor.html");
        System.out.println(webURL);
        ftpURL = new URL("ftp", "ftp.macfaq.com", "/pub");
        System.out.println(ftpURL);

        webURL = new URL("http", "www.macfaq.com", 80, "/vendor.html");
        System.out.println(webURL);
        ftpURL = new URL("ftp", "ftp.macfaq.com", 21, "/pub");
        System.out.println(ftpURL);

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

}

From source file:MainClass.java

public static void main(String args[]) {
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);// w  w w . j  a  v a2s. c o m
    spf.setValidating(true);
    System.out.println("Parser will " + (spf.isNamespaceAware() ? "" : "not ") + "be namespace aware");
    System.out.println("Parser will " + (spf.isValidating() ? "" : "not ") + "validate XML");

    SAXParser parser = null;
    try {
        parser = spf.newSAXParser();
    } catch (ParserConfigurationException e) {
        e.printStackTrace(System.err);
    } catch (SAXException e) {
        e.printStackTrace(System.err);
    }
    System.out.println("Parser object is: " + parser);
}

From source file:ImagesAlignmentWithTextPDF.java

public static void main(java.lang.String[] args) {
    Document document = new Document();
    try {/*  w  w w. ja v a  2s  . c o m*/
        PdfWriter.getInstance(document, new FileOutputStream("ImagesAlignmentWithTextPDF.pdf"));
        document.open();

        Image imageRight = Image.getInstance("logo.png");
        imageRight.setAlignment(Image.RIGHT | Image.TEXTWRAP);

        for (int i = 0; i < 100; i++) {
            document.add(new Phrase("Text "));
        }
        document.add(imageRight);
        for (int i = 0; i < 150; i++) {
            document.add(new Phrase("Text "));
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:AffineTransformationPDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A4);
    try {/*from   w  w  w. j  av  a  2 s  .  c o  m*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("AffineTransformationPDF.pdf"));
        document.open();
        PdfContentByte cb = writer.getDirectContent();
        cb.transform(AffineTransform.getScaleInstance(1.2, 0.75));

        cb.moveTo(216, 720);
        cb.lineTo(360, 360);
        cb.lineTo(360, 504);
        cb.lineTo(72, 144);
        cb.lineTo(144, 288);
        cb.stroke();

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

From source file:DateParse2.java

public static void main(String[] args) {

    //+/* www .ja  v a 2 s  .co  m*/
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
    String input[] = { "BD: 1913-10-01 Vancouver, B.C.", "MD: 1948-03-01 Ottawa, ON",
            "DD: 1983-06-06 Toronto, ON" };
    for (int i = 0; i < input.length; i++) {
        String aLine = input[i];
        String action;
        switch (aLine.charAt(0)) {
        case 'B':
            action = "Born";
            break;
        case 'M':
            action = "Married";
            break;
        case 'D':
            action = "Died";
            break;
        // others...
        default:
            System.err.println("Invalid code in " + aLine);
            continue;
        }
        int p = aLine.indexOf(' ');
        ParsePosition pp = new ParsePosition(p);
        Date d = formatter.parse(aLine, pp);
        if (d == null) {
            System.err.println("Invalid date in " + aLine);
            continue;
        }
        String location = aLine.substring(pp.getIndex());
        System.out.println(action + " on " + d + " in " + location);
    }
    //-
}