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:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("ttc.pdf")); document.open();/*w w w .j a va2 s.c om*/ BaseFont bf; Font font; bf = BaseFont.createFont("c:/windows/fonts/msgothic.ttc,0", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); font = new Font(bf, 12); System.err.println(bf.getClass().getName()); document.add(new Paragraph("abcde", font)); document.add(new Paragraph("\u7f85\u751f\u9580", font)); String[] names = BaseFont.enumerateTTCNames("c:/windows/fonts/msgothic.ttc"); for (int i = 0; i < names.length; i++) { document.add(new Paragraph("font " + i + ": " + names[i], font)); } document.close(); }
From source file:X.java
public static void main(String[] args) { try {//from w ww . ja va2 s. c om Class<?> clazz = Class.forName("X"); X x = (X) clazz.newInstance(); Class[] argTypes = { String.class }; Method method = clazz.getMethod("objectMethod", argTypes); System.out.println(method.getDeclaringClass()); } catch (Exception e) { System.err.println(e); } }
From source file:ShapeRectanglePDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from ww w .j a v a 2s . c om*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ShapeRectanglePDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); cb.setLineWidth(10f); cb.rectangle(100, 700, 100, 100); cb.stroke(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:StrokeLineWidthPDF.java
public static void main(String[] args) { Document document = new Document(); try {// www .j a va 2s. c o m PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("StrokeLineWidthPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); cb.setLineWidth(10f); cb.rectangle(100, 700, 100, 100); cb.stroke(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:FontStyle2PDF.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("FontStyle2PDF.pdf")); document.open(); Phrase myPhrase = new Phrase("new Font(Font.TIMES_ROMAN, 8, Font.BOLD)", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)); document.add(myPhrase); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:BeanUtilsExampleV1.java
public static void main(String args[]) throws Exception { BeanUtilsExampleV1 diff = new BeanUtilsExampleV1(); Movie movieBean = diff.prepareData(); System.err.println("Movie Title: " + BeanUtils.getProperty(movieBean, "title")); System.err.println("Movie Year: " + BeanUtils.getProperty(movieBean, "dateOfRelease")); System.err.println("Movie Director: " + BeanUtils.getProperty(movieBean, "director.name")); System.err.println("Movie Director Home Contact: " + BeanUtils.getProperty(movieBean, "director.contactNumber(Home)")); System.err.println("Movie Genre (Thriller): " + BeanUtils.getProperty(movieBean, "genre(THR)")); System.err.println("Movie Actor 1 name: " + BeanUtils.getProperty(movieBean, "actors[0].name")); System.err.println("Movie Actor 1 worth: " + BeanUtils.getProperty(movieBean, "actors[0].worth")); System.err.println("Movie Actor 1 other movie 1: " + BeanUtils.getProperty(movieBean, "actors[0].movieCredits[0].title")); }
From source file:SimpleProxyServer.java
public static void main(String[] args) throws IOException { try {/* ww w .j a v a 2 s . co m*/ String host = "your Proxy Server"; int remoteport = 100; int localport = 111; // Print a start-up message System.out.println("Starting proxy for " + host + ":" + remoteport + " on port " + localport); // And start running the server runServer(host, remoteport, localport); // never returns } catch (Exception 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 {/* w w w.j a v a 2s . co m*/ JEditorPane editorPane = new JEditorPane("http://www.java2s.com"); editorPane.setEditable(false); String b = editorPane.getText(); 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) { long[] primes = new long[] { 1, 2, 3, 5, 7 }; File aFile = new File("C:/test/primes.bin"); FileOutputStream outputFile = null; try {// w w w . j av a2s. c om outputFile = new FileOutputStream(aFile); } catch (FileNotFoundException e) { e.printStackTrace(System.err); } FileChannel file = outputFile.getChannel(); final int BUFFERSIZE = 100; ByteBuffer buf = ByteBuffer.allocate(BUFFERSIZE); LongBuffer longBuf = buf.asLongBuffer(); int primesWritten = 0; while (primesWritten < primes.length) { longBuf.put(primes, primesWritten, min(longBuf.capacity(), primes.length - primesWritten)); buf.limit(8 * longBuf.position()); try { file.write(buf); primesWritten += longBuf.position(); } catch (IOException e) { e.printStackTrace(System.err); } longBuf.clear(); buf.clear(); } try { System.out.println("File written is " + file.size() + "bytes."); outputFile.close(); } catch (IOException e) { e.printStackTrace(System.err); } }
From source file:OutputPDFCommandForDebug.java
public static void main(String[] args) { Document document = new Document(); try {/*from ww w.j a v a 2s.com*/ PdfWriter.getInstance(document, System.out); PdfWriter.getInstance(document, new FileOutputStream("OutputPDFCommandForDebug.txt")); 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(); }