List of usage examples for java.lang System err
PrintStream err
To view the source code for java.lang System err.
Click Source Link
From source file:ShapeDashLinePDF.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w.java2s . co m PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ShapeDashLinePDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); cb.setLineWidth(10f); cb.setLineDash(3, 3, 0); cb.moveTo(100, 700); cb.lineTo(200, 800); cb.stroke(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
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 2 s. c o m*/ JEditorPane editorPane = new JEditorPane("http://www.java2s.com"); editorPane.setEditable(false); boolean b = editorPane.getScrollableTracksViewportHeight(); 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:Main.java
public static void main(String[] args) { Path rn_demo = Paths.get("C:/tutorial/Java", "demo.txt"); String demo = "tutorial"; String string = "\nString: from java2s.com"; //using NIO.2 unbuffered stream byte data[] = demo.getBytes(); try (OutputStream outputStream = Files.newOutputStream(rn_demo)) { outputStream.write(data);/*from ww w . j a v a2s. c o m*/ } catch (IOException e) { System.err.println(e); } }
From source file:StrokeColorPDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from w ww . j a va 2s . com*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("StrokeColorPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); cb.setLineWidth(10f); cb.setRGBColorStrokeF(0f, 255f, 0f); cb.moveTo(100, 700); cb.lineTo(200, 800); cb.stroke(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:BasicAuthenticationExecuteJSPMethod.java
public static void main(String args[]) throws Exception { HttpClient client = new HttpClient(); client.getParams().setParameter("parameterKey", "value"); HostConfiguration host = client.getHostConfiguration(); host.setHost(new URI("http://localhost:8080", true)); GetMethod method = new GetMethod("/commons/folder/protected.jsp"); try {//from w ww. ja v a 2 s. c o m client.executeMethod(host, method); System.err.println(method.getStatusLine()); System.err.println(method.getResponseBodyAsString()); } catch (Exception e) { System.err.println(e); } finally { method.releaseConnection(); } }
From source file:FontStyle3PDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w. j a v a 2 s . co m PdfWriter.getInstance(document, new FileOutputStream("FontStyle3PDF.pdf")); document.open(); Phrase myPhrase = new Phrase("FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD)); document.add(myPhrase); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:UnderlinedTextPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w.j a v a2 s.co m PdfWriter.getInstance(document, new FileOutputStream("UnderlinedTextPDF.pdf")); document.open(); Chunk underlined = new Chunk("underlined"); underlined.setUnderline(0.2f, -2f); Paragraph p = new Paragraph("The following chunk is "); p.add(underlined); document.add(p); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:MainClass.java
License:asdf
public static void main(String[] args) throws IOException { try {/* ww w.j av a 2 s. c om*/ BufferedReader in4 = new BufferedReader(new StringReader("asdf")); PrintWriter out1 = new PrintWriter(new BufferedWriter(new FileWriter("IODemo.out"))); int lineCount = 1; String s = null; while ((s = in4.readLine()) != null) out1.println(lineCount++ + ": " + s); out1.close(); } catch (EOFException e) { System.err.println("End of stream"); } }
From source file:Main.java
public static void main(String args[]) { try {//from w w w. jav a 2 s . c om MongoClient mongoClient = new MongoClient("localhost", 27017); // Now connect to your databases DB db = mongoClient.getDB("test"); System.out.println("Connect to database successfully"); boolean auth = db.authenticate("myUserName", "myPassword".toCharArray()); System.out.println("Authentication: " + auth); DBCollection coll = db.createCollection("mycol", null); System.out.println("Collection created successfully"); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } }
From source file:Main.java
public static void main(String[] args) { for (int i = 0; i < args.length; i++) { try {/*from ww w . ja va 2 s. c o m*/ FileInputStream fin = new FileInputStream(args[i]); FileOutputStream fout = new FileOutputStream(args[i] + "dfl"); DeflaterOutputStream dos = new DeflaterOutputStream(fout); for (int c = fin.read(); c != -1; c = fin.read()) { dos.write(c); } dos.close(); fin.close(); } catch (IOException ex) { System.err.println(ex); } } }