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:abs.backend.erlang.ErlangBackend.java

public static void main(final String... args) {
    try {/*from  w  ww  .  jav  a  2 s  .  c  o m*/
        new ErlangBackend().compile(args);
    } catch (InternalBackendException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    } catch (NotImplementedYetException e) {
        System.err.println(e.getMessage());
        System.exit(0);
    } catch (Exception e) {
        System.err.println("An error occurred during compilation:\n" + e.getMessage());
        if (Arrays.asList(args).contains("-debug")) {
            e.printStackTrace();
        }
        System.exit(1);
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    try {/*from   w w w  . ja v  a  2  s . c  om*/
        String url = "jdbc:odbc:yourdatabasename";
        String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
        String user = "guest";
        String password = "guest";

        Class.forName(driver);
        Connection connection = DriverManager.getConnection(url, user, password);
        Statement stmt = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                ResultSet.CONCUR_READ_ONLY);

        ResultSet rs = stmt.executeQuery("SELECT * from DUMMY");

        System.out.println(rs.getType());
        System.out.println(rs.getConcurrency());

        rs.deleteRow();
        rs.close();

        rs.close();
        stmt.close();
        connection.close();
    } catch (Exception e) {
        System.err.println(e);
    }
}

From source file:ChunkFontColorPDF.java

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

        Font red = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLD,
                new Color(0xFF, 0x00, 0x00));
        Paragraph p;
        p = new Paragraph("Red is ");
        p.add(new Chunk("red", red));

        document.add(p);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:Delete.java

/**
 * This is the main() method of the standalone program. After checking it
 * arguments, it invokes the Delete.delete() method to do the deletion
 *//*from   ww w .j  av  a2s  .c o  m*/
public static void main(String[] args) {
    if (args.length != 1) { // Check command-line arguments
        System.err.println("Usage: java Delete <file or directory>");
        System.exit(0);
    }
    // Call delete() and display any error messages it throws.
    try {
        delete(args[0]);
    } catch (IllegalArgumentException e) {
        System.err.println(e.getMessage());
    }
}

From source file:Convert2pdfptable.java

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

        document.open();

        Table table = new Table(2);
        table.setBorderWidth(1);
        table.setPadding(10);
        Cell cell = new Cell("header");
        cell.setHeader(true);
        cell.setColspan(2);
        table.addCell(cell);
        table.addCell("1.1");
        table.addCell("2.1");

        table.addCell("3.1");
        table.addCell("1.2");

        table.addCell("2.2");
        table.addCell("3.2");
        table.setConvert2pdfptable(true);
        document.add(table);

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

From source file:SimpleAttributeBoldItalic.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Simple Attributes");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    StyledDocument document = new DefaultStyledDocument();

    SimpleAttributeSet attributes = new SimpleAttributeSet();
    attributes.addAttribute(StyleConstants.CharacterConstants.Bold, Boolean.TRUE);
    attributes.addAttribute(StyleConstants.CharacterConstants.Italic, Boolean.TRUE);

    try {/*from www.j a  v  a2  s .  c om*/
        document.insertString(document.getLength(), "Bold, Italic", attributes);
    } catch (BadLocationException badLocationException) {
        System.err.println("Bad insert");
    }

    JTextPane textPane = new JTextPane(document);
    textPane.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(textPane);

    frame.add(scrollPane, BorderLayout.CENTER);

    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    try {//from  w w  w  . j  a  v a  2s. c o  m
        Connection conn = getHSQLConnection();

        conn.setAutoCommit(false);
        Statement st = conn.createStatement();
        st.executeUpdate("create table survey (id int,name varchar(30));");
        st.executeUpdate("insert into survey (id,name ) values (1,'nameValue')");
        st = conn.createStatement();
        ResultSet rs = st.executeQuery("SELECT * FROM survey");

        outputResultSet(rs);

        rs.close();
        st.close();
        conn.close();
    } catch (SQLException sqle) {
        String sqlMessage = sqle.getMessage();
        String sqlState = sqle.getSQLState();
        int vendorCode = sqle.getErrorCode();
        System.err.println("Exception occurred:");
        System.err.println("Message: " + sqlMessage);
        System.err.println("SQL state: " + sqlState);
        System.err.println("Vendor code: " + vendorCode + "\n----------------");
    }
}

From source file:EncryptedPDFAllowAssemblyFillInScreenReadersModifyContents.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from   w w w.  j av a  2  s.  co m
        PdfWriter writer = PdfWriter.getInstance(document,
                new FileOutputStream("EncryptedPDFAllowAssemblyFillInScreenReadersModifyContents.pdf"));
        // setEncryption(boolean strength, String userPassword, String
        // ownerPassword, int permissions)
        writer.setEncryption(PdfWriter.STRENGTH40BITS, "java2s.com", "World", PdfWriter.AllowAssembly
                | PdfWriter.AllowFillIn | PdfWriter.AllowScreenReaders | PdfWriter.AllowModifyContents);

        document.open();

        document.add(new Paragraph("Hello World"));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    JFrame frame = new JFrame("Mask Input");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLabel label;//  w  ww .j  a  v  a 2s .c o m
    JFormattedTextField input;
    JPanel panel;
    MaskFormatter formatter;

    try {
        label = new JLabel("US Phone");
        formatter = new MaskFormatter("'(###')' ###'-####");
        formatter.setPlaceholderCharacter('*');
        input = new JFormattedTextField(formatter);
        input.setColumns(20);
        panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        panel.add(label);
        panel.add(input);
        frame.add(panel);
    } catch (ParseException e) {
        System.err.println("Unable to add Phone");
    }

    frame.pack();
    frame.setVisible(true);
}

From source file:TableCellWithFontPDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A4);
    try {/* w  ww  . j  a va2 s .  com*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("TableCellWithFontPDF.pdf"));
        document.open();

        PdfPTable table = new PdfPTable(1);
        PdfPCell cell = new PdfPCell(new Phrase("phrase without font"));

        table.addCell(cell);
        table.addCell(new Phrase("A", FontFactory.getFont(FontFactory.HELVETICA, 8)));
        table.addCell("no font");

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