List of usage examples for java.lang Exception printStackTrace
public void printStackTrace()
From source file:Main.java
public static void main(String[] args) { try {//from w w w . j av a 2 s . co m SwingUtilities.invokeAndWait(new Runnable() { public void run() { System.out.println("Hello World on " + Thread.currentThread()); } }); } catch (Exception e) { e.printStackTrace(); } System.out.println("Finished on " + Thread.currentThread()); }
From source file:Main.java
public static void main(String[] args) { ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("js"); try {//w ww .j a v a 2s.c o m FileReader reader = new FileReader("yourFile.js"); engine.eval(reader); reader.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { String srcFile = "test.txt"; try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(srcFile))) { // Read one byte at a time and display it byte byteData; while ((byteData = (byte) bis.read()) != -1) { System.out.print((char) byteData); }// w w w . j a va 2s . c o m } catch (Exception e2) { e2.printStackTrace(); } }
From source file:MainClass.java
public static void main(String args[]) { try {//w ww. jav a 2 s .c o m System.out.println("pathSeparatorChar = " + File.pathSeparatorChar); } catch (Exception e) { e.printStackTrace(); } }
From source file:Message.java
public static void main(String[] args) { try {/*from ww w . jav a 2 s. c o m*/ // register Message as shutdown hook Runtime runTime = Runtime.getRuntime(); runTime.addShutdownHook(new Message()); } catch (Exception e) { e.printStackTrace(); } }
From source file:HelloWorldRtf.java
public static void main(String[] args) { try {//from ww w . ja v a 2 s .c om Document document = new Document(); RtfWriter2.getInstance(document, new FileOutputStream("HelloWorldRtf.rtf")); document.open(); document.add(new Paragraph("Hello World!")); document.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:ExceptionUtilsV1.java
public static void main(String args[]) { try {/*from ww w .j a v a 2s.c o m*/ loadFile(); } catch (Exception e) { e.printStackTrace(); } }
From source file:ListEncodingsPDF.java
public static void main(String[] args) { try {/*from w w w .ja v a 2 s .c o m*/ BaseFont bfComic = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED); System.out.println("postscriptname: " + bfComic.getPostscriptFontName()); String[] codePages = bfComic.getCodePagesSupported(); System.out.println("All available encodings:\n\n"); for (int i = 0; i < codePages.length; i++) { System.out.println(codePages[i]); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { Class[] classParm = null;/* w ww .ja v a2 s . c o m*/ Object[] objectParm = null; try { String name = "java.lang.String"; Class cl = Class.forName(name); java.lang.reflect.Constructor co = cl.getConstructor(classParm); System.out.println(co.newInstance(objectParm)); } catch (Exception e) { e.printStackTrace(); } }
From source file:ConcatenateFormsPDF.java
public static void main(String[] args) { try {//from w w w .j ava 2 s .co m PdfReader reader1 = new PdfReader("SimpleRegistrationForm.pdf"); PdfReader reader2 = new PdfReader("SimpleRegistrationForm.pdf"); PdfCopyFields copy = new PdfCopyFields(new FileOutputStream("ConcatenateFormsPDF.pdf")); copy.addDocument(reader1); copy.addDocument(reader2); copy.close(); } catch (Exception e) { e.printStackTrace(); } }