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:guru.nidi.raml.doc.Main.java

public static void main(String[] args) {
    System.out.println("RAML doc. Version " + Version.VERSION);
    try {//from   w ww.  ja va2 s.c  o m
        final GeneratorConfig config = new OptionParser().parse(args);
        config.generate();
        System.out.println("Generated Documentation in '" + config.getTarget() + "'");
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        new OptionParser().showHelp();
        System.exit(1);
    } catch (Exception e) {
        System.err.println("Problem generating RAML documentation.");
        e.printStackTrace();
        System.exit(1);
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    try {/*  w  w  w  .  j a v  a  2 s. co  m*/
        String url = "jdbc:odbc:databaseName";
        String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
        String user = "guest";
        String password = "guest";
        Class.forName(driver);
        Connection connection = DriverManager.getConnection(url, user, password);
        String changeLastName = "UPDATE authors SET lastname = ? WHERE authid = ?";
        PreparedStatement updateLastName = connection.prepareStatement(changeLastName);

        updateLastName.setString(1, "Martin"); // Set lastname placeholder value
        updateLastName.setInt(2, 4); // Set author ID placeholder value

        int rowsUpdated = updateLastName.executeUpdate(); // execute the update
        System.out.println("Rows affected: " + rowsUpdated);
        connection.close();
    } catch (ClassNotFoundException cnfe) {
        System.err.println(cnfe);
    } catch (SQLException sqle) {
        System.err.println(sqle);
    }
}

From source file:CreatingAnchorInPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from ww w .ja  v a  2  s  .  co  m*/
        PdfWriter pdf = PdfWriter.getInstance(document, new FileOutputStream("CreatingAnchorInPDF.pdf"));

        document.open();
        document.add(new Paragraph("Some text"));

        Anchor pdfRef = new Anchor("http://www.java2s.com");
        pdfRef.setReference("www.java2s.com");
        Anchor rtfRef = new Anchor("Link for a web page.");
        rtfRef.setReference("www.java2s.com/aFileOnWebsite.htm");

        document.add(pdfRef);
        document.add(Chunk.NEWLINE);
        document.add(rtfRef);

    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:Main.java

static public void main(String[] arg) {
    boolean validate = true;

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(validate);/*from www  . j ava 2s .co  m*/
    dbf.setNamespaceAware(true);

    try {
        DocumentBuilder builder = dbf.newDocumentBuilder();
        builder.setErrorHandler(new MyErrorHandler());
        InputSource is = new InputSource(new StringReader(getXMLData()));
        Document doc = builder.parse(is);
    } catch (SAXException e) {
        System.out.println(e);
    } catch (ParserConfigurationException e) {
        System.err.println(e);
    } catch (IOException e) {
        System.err.println(e);
    }
}

From source file:PauseWritingAndResumeWritingPDF.java

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

        document.open();
        document.add(new Paragraph("Some text"));

        Anchor pdfRef = new Anchor("a link");
        pdfRef.setReference("http://www.java2s.com");

        pdf.pause();

        document.add(pdfRef);
        document.add(Chunk.NEWLINE);

        document.add(pdfRef);
        document.add(Chunk.NEWLINE);

        pdf.resume();
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:TestAccessExcel.java

public static void main(String args[]) {
    Connection conn = null;//from   w ww .j a v  a 2 s.co m
    Statement stmt = null;
    ResultSet rs = null;
    try {
        conn = getConnection();
        stmt = conn.createStatement();
        String excelQuery = "select * from [Sheet1$]";
        rs = stmt.executeQuery(excelQuery);

        while (rs.next()) {
            System.out.println(rs.getString("BadgeNumber") + " " + rs.getString("FirstName") + " "
                    + rs.getString("LastName"));
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
    } finally {
        try {
            rs.close();
            stmt.close();
            conn.close();

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

From source file:MainClass.java

static public void main(String[] arg) {
    boolean validate = false;

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(validate);/*w  w  w .j  a  v a 2  s  . c  o m*/
    dbf.setNamespaceAware(true);
    dbf.setIgnoringElementContentWhitespace(true);

    Document doc = null;
    try {
        DocumentBuilder builder = dbf.newDocumentBuilder();
        doc = builder.parse(new InputSource(new StringReader(xmlString)));
    } catch (SAXException e) {
        System.exit(1);
    } catch (ParserConfigurationException e) {
        System.err.println(e);
        System.exit(1);
    } catch (IOException e) {
        System.err.println(e);
        System.exit(1);
    }

    TreeDumper td = new TreeDumper();
    td.dump(doc);
}

From source file:CreatingHyperLinkForHTML.java

public static void main(String[] args) {
    Document document = new Document();
    try {//  w w w  .java  2 s.c  om
        HtmlWriter html = HtmlWriter.getInstance(document,
                new FileOutputStream("CreatingHyperLinkForHTML.html"));

        document.open();
        document.add(new Paragraph("Some text"));

        Anchor pdfRef = new Anchor("http://www.java2s.com");
        pdfRef.setReference("http://www.java2s.com");
        Anchor rtfRef = new Anchor("a File");
        rtfRef.setReference("./aFile.htm");

        document.add(pdfRef);
        document.add(Chunk.NEWLINE);
        document.add(rtfRef);

    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeB3B4B5.java

public static void main(String[] args) {
    Document document = new Document();
    try {/* ww w . j  a va 2s  . c  o m*/
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeB3B4B5.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.B3);
        document.newPage();
        document.add(new Paragraph("This PageSize is B3."));

        document.setPageSize(PageSize.B4);
        document.newPage();
        document.add(new Paragraph("This PageSize is B4."));

        document.setPageSize(PageSize.B5);
        document.newPage();
        document.add(new Paragraph("This PageSize is B5."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:com.oneops.boo.Main.java

/**
 * The main method.//from   w w w.j a  va2  s  . c om
 *
 * @param args the arguments
 */
public static void main(String[] args) {
    BooCli cli = new BooCli();
    int exit = 0;
    try {
        exit = cli.parse(args);
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        exit = Constants.EXIT_PARSE_ERROR;
    } catch (BooException e) {
        System.err.println(e.getMessage());
        exit = Constants.EXIT_BOO;
    } catch (OneOpsClientAPIException e) {
        System.err.println(e.getMessage());
        exit = Constants.EXIT_CLIENT;
    } catch (Exception e) {
        System.err.println(e.getMessage());
        exit = Constants.EXIT_UNKOWN;
    } finally {
        System.exit(exit);
    }

}