List of usage examples for java.lang Exception printStackTrace
public void printStackTrace()
From source file:CellPaddingTopLeftPDF.java
public static void main(String[] args) { Document document = new Document(PageSize.A4.rotate(), 10, 10, 10, 10); try {/*from w w w . j a v a 2 s . co m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("CellPaddingTopLeftPDF.pdf")); document.open(); PdfPTable table = new PdfPTable(2); PdfPCell cell; Paragraph p = new Paragraph( "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text "); table.addCell("cell"); table.addCell(p); table.addCell("cell"); cell = new PdfPCell(p); cell.setPaddingTop(0f); cell.setPaddingLeft(20f); table.addCell(cell); table.addCell("cell"); document.add(table); } catch (Exception de) { de.printStackTrace(); } document.close(); }
From source file:Main.java
public static void main(String[] args) { Thread t = Thread.currentThread(); Main t1 = new Main(3); t1.createThread("Child 1"); t1.createThread("Child 2"); for (int i = 0; i <= 5; i++) { try {//from w w w .j a v a 2s. c om Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } System.out.println("The cirrent Thread is " + t.getName() + " and thread ID is " + t.getId()); } }
From source file:SqlWarning.java
public static void main(String[] args) { try {/*from www.jav a2 s.c o m*/ Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:ORCL"; Connection conn = DriverManager.getConnection(jdbcUrl, "yourName", "mypwd"); Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); SQLWarning sw = null; ResultSet rs = stmt.executeQuery("Select * from employees"); sw = stmt.getWarnings(); System.out.println(sw.getMessage()); while (rs.next()) { System.out.println("Employee name: " + rs.getString(2)); } rs.previous(); rs.updateString("name", "Jon"); } catch (SQLException se) { System.out.println("SQLException occurred: " + se.getMessage()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {/*from ww w. ja v a 2 s .com*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } SwingUtilities.invokeLater(() -> { Main frame = new Main(); frame.pack(); frame.setVisible(true); frame.setExtendedState(frame.MAXIMIZED_BOTH); }); }
From source file:Bookmarks1PDF.java
public static void main(String[] args) { Document document = new Document(PageSize.A6); try {/*from w w w . j av a 2 s. c om*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("Bookmarks1PDF.pdf")); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines); document.open(); document.add(new Paragraph("Text.", new Font(Font.HELVETICA, 12))); PdfContentByte cb = writer.getDirectContent(); PdfDestination destination = new PdfDestination(PdfDestination.FITH, 0); PdfOutline outline = new PdfOutline(cb.getRootOutline(), destination, "paragraph " + 1); document.add(new Paragraph("Text.", new Font(Font.HELVETICA, 12))); document.add(new Paragraph("Text.", new Font(Font.HELVETICA, 12))); cb = writer.getDirectContent(); destination = new PdfDestination(PdfDestination.FITH, 1); outline = new PdfOutline(cb.getRootOutline(), destination, "paragraph " + 2); document.add(new Paragraph("Text.", new Font(Font.HELVETICA, 12))); } catch (Exception de) { de.printStackTrace(); } document.close(); }
From source file:PatternPDF.java
public static void main(String[] args) { Document document = new Document(PageSize.A4, 50, 50, 50, 50); try {/* ww w . j a va 2 s. c om*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PatternPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(400, 300); PdfPatternPainter pat = cb.createPattern(15, 15, null); pat.rectangle(5, 5, 5, 5); pat.fill(); PdfSpotColor spc_cmyk = new PdfSpotColor("PANTONE 280 CV", 0.25f, new CMYKColor(0.9f, .2f, .3f, .1f)); SpotColor spot = new SpotColor(spc_cmyk); tp.setPatternFill(pat, spot, .9f); tp.rectangle(0, 0, 40, 30); tp.fill(); cb.addTemplate(tp, 50, 50); } catch (Exception de) { de.printStackTrace(); } document.close(); }
From source file:TestSupportsTransactions.java
public static void main(String[] args) throws Exception { Connection conn = getOracleConnection(); try {/* w w w.j a va 2 s .c o m*/ System.out.println("conn=" + conn); System.out.println("Transaction Support:" + supportsTransactions(conn)); } catch (Exception e) { e.printStackTrace(); System.exit(1); } finally { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } }
From source file:com.alibaba.dubbo.examples.merge.MergeConsumer.java
public static void main(String[] args) throws Exception { String config = MergeConsumer.class.getPackage().getName().replace('.', '/') + "/merge-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start();/*from w w w . j a v a2 s . com*/ MergeService mergeService = (MergeService) context.getBean("mergeService"); for (int i = 0; i < Integer.MAX_VALUE; i++) { try { List<String> result = mergeService.mergeResult(); System.out.println("(" + i + ") " + result); Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } } }
From source file:com.alibaba.dubbo.examples.merge.MergeConsumer2.java
public static void main(String[] args) throws Exception { String config = MergeConsumer2.class.getPackage().getName().replace('.', '/') + "/merge-consumer2.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start();/*from ww w . j a v a2 s .c o m*/ MergeService mergeService = (MergeService) context.getBean("mergeService"); for (int i = 0; i < Integer.MAX_VALUE; i++) { try { List<String> result = mergeService.mergeResult(); System.out.println("(" + i + ") " + result); Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } } }
From source file:com.jkoolcloud.client.samples.query.QueryData1.java
public static void main(String[] args) { try {//www . j a v a 2 s .c o m Properties props = new Properties(); props.setProperty(JKCmdOptions.PROP_URI, JKQuery.JKOOL_QUERY_URL); JKCmdOptions options = new JKCmdOptions(QueryData1.class, args, props); if (options.usage != null) { System.out.println(options.usage); System.exit(-1); } options.print(); JKQuery jkQuery = new JKQuery(options.token); HttpResponse response = jkQuery.get(options.query); System.out.println(EntityUtils.toString(response.getEntity())); } catch (Exception e) { e.printStackTrace(); } }