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

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

        document.open();

        Chunk chunk = new Chunk("This is a chunk.");
        chunk.setSkew(-45f, 0f);
        document.add(chunk);

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

From source file:Blobs.java

public static void main(String args[]) {
    if (args.length != 1) {
        System.err.println("Syntax: <java Blobs [driver] [url] " + "[uid] [pass] [file]");
        return;//  www  . jav a  2s  . co m
    }
    try {
        Class.forName(args[0]).newInstance();
        Connection con = DriverManager.getConnection(args[1], args[2], args[3]);
        File f = new File(args[4]);
        PreparedStatement stmt;

        if (!f.exists()) {
            // if the file does not exist
            // retrieve it from the database and write it to the named file
            ResultSet rs;

            stmt = con.prepareStatement("SELECT blobData " + "FROM BlobTest " + "WHERE fileName = ?");

            stmt.setString(1, args[0]);
            rs = stmt.executeQuery();
            if (!rs.next()) {
                System.out.println("No such file stored.");
            } else {
                Blob b = rs.getBlob(1);
                BufferedOutputStream os;

                os = new BufferedOutputStream(new FileOutputStream(f));
                os.write(b.getBytes(0, (int) b.length()), 0, (int) b.length());
                os.flush();
                os.close();
            }
        } else {
            // otherwise read it and save it to the database
            FileInputStream fis = new FileInputStream(f);
            byte[] tmp = new byte[1024];
            byte[] data = null;
            int sz, len = 0;

            while ((sz = fis.read(tmp)) != -1) {
                if (data == null) {
                    len = sz;
                    data = tmp;
                } else {
                    byte[] narr;
                    int nlen;

                    nlen = len + sz;
                    narr = new byte[nlen];
                    System.arraycopy(data, 0, narr, 0, len);
                    System.arraycopy(tmp, 0, narr, len, sz);
                    data = narr;
                    len = nlen;
                }
            }
            if (len != data.length) {
                byte[] narr = new byte[len];

                System.arraycopy(data, 0, narr, 0, len);
                data = narr;
            }
            stmt = con.prepareStatement("INSERT INTO BlobTest(fileName, " + "blobData) VALUES(?, ?)");
            stmt.setString(1, args[0]);
            stmt.setObject(2, data);
            stmt.executeUpdate();
            f.delete();
        }
        con.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ImageAbsolutePositionsPDF.java

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

        Image png = Image.getInstance("logo.png");
        png.setAbsolutePosition(170, 250);

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

From source file:Main.java

public static void main(String[] args) {

    Path path = Paths.get("C:/tutorial/Java/JavaFX");

    //no filter applyied
    try (DirectoryStream<Path> ds = Files.newDirectoryStream(path)) {
        for (Path file : ds) {
            System.out.println(file.getFileName());
        }//www  .ja v  a 2s.  com
    } catch (IOException e) {
        System.err.println(e);
    }

}

From source file:ExtraStyleSTRIKETHRUPDF.java

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

        document.add(new Chunk("underline",
                FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.STRIKETHRU)));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:Main.java

public static void main(String[] args) {

    Path path = Paths.get("C:/tutorial/Java/JavaFX", "Topic.txt");

    long time = System.currentTimeMillis();
    FileTime fileTime = FileTime.fromMillis(time);
    try {//from  ww  w  . ja va  2 s  .  com
        BasicFileAttributeView bv = Files.getFileAttributeView(path, BasicFileAttributeView.class);
        bv.setTimes(fileTime, fileTime, fileTime);
    } catch (IOException e) {
        System.err.println(e);
    }

}

From source file:Main.java

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

    try {// www.  j av  a 2s  .co m
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);
        URL url = editorPane.getPage();

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:MainClass.java

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

    JTextField nameTextField = new JTextField();
    frame.add(nameTextField, BorderLayout.NORTH);

    FileReader reader = null;//from   www  .ja v a2  s  .c  o  m
    try {
        reader = new FileReader("fileName.txt");
        nameTextField.read(reader, "fileName.txt");
    } catch (IOException exception) {
        System.err.println("Load oops");
        exception.printStackTrace();
    } finally {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException exception) {
                System.err.println("Error closing reader");
                exception.printStackTrace();
            }
        }
    }

    frame.setSize(250, 100);
    frame.setVisible(true);
}

From source file:Test.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);

    GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();

    if (!graphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) {
        System.err.println("Translucency is not supported on this platform");
        System.exit(0);/*www.j  a v a2 s  .c o  m*/
    }
    ApplicationWindow window = new ApplicationWindow();
    window.setOpacity(0.75f);
    window.setVisible(true);
}

From source file:OptionsMethodExample.java

public static void main(String args[]) {

    HttpClient client = new HttpClient();
    client.getParams().setParameter("http.useragent", "Test Client");

    OptionsMethod method = new OptionsMethod("http://www.google.com");

    try {//from  ww w. j a v  a 2 s.co  m
        int returnCode = client.executeMethod(method);

        Enumeration list = method.getAllowedMethods();

        while (list.hasMoreElements()) {
            System.err.println(list.nextElement());
        }

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

}