List of usage examples for java.lang Exception printStackTrace
public void printStackTrace()
From source file:net.kamhon.ieagle.vo.ManagerList.java
public static void main(String a[]) { try {/*from w w w . ja va 2s . c o m*/ Set<String> clazzStr = ReflectionUtil.findFileNames("com", true, "net.kamhon.+?\\.manager\\..+?"); for (String str : clazzStr) { // if (clazz.) { // add(clazz); // } // add(str.getClass().getName()); log.info((str.substring(str.lastIndexOf(".") + 1).charAt(0) + "").toLowerCase() + str.substring(str.lastIndexOf(".") + 2)); } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.ah.test.SendCollectionTest.java
public static void main(String[] args) { SendCollectionTest test = new SendCollectionTest(); System.out.println("test..start"); try {/*from ww w .j av a 2 s . c o m*/ HmBeManager be = new HmBeManager(); be.startBe(); test.test_1(); be.stopBe(); } catch (Exception e) { e.printStackTrace(); } System.out.println("test..end"); }
From source file:com.googlecode.lineblog.websocket.v2.WebSocketServer.java
public static void main(String[] args) { try {//from ww w . j a v a2 s .c o m ServerSocket ss = new ServerSocket(SERVER_PORT); log.info("Listen----" + SERVER_PORT + "----port!"); new Console().start(); while (true) { Socket sk = ss.accept(); new TokenThread(sk).start(); } } catch (Exception e) { e.printStackTrace(); } }
From source file:edu.ku.brc.specify.plugins.ipadexporter.MD5Checksum.java
public static void main(String args[]) { try {//from www. ja v a 2 s . c om System.out .println(getMD5Checksum(new File("/Users/rods/Documents/Specify/ipad_export/taxon_types.png"))); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton loadButton = new JButton("Display Image"); loadButton.addActionListener(ev -> { JFileChooser fc = new JFileChooser(System.getProperty("user.home")); fc.addChoosableFileFilter(//from w w w. j a va 2s .co m new FileNameExtensionFilter("Image files", new String[] { "png", "jpg", "jpeg", "gif" })); if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { try { Image image = ImageIO.read(fc.getSelectedFile()); if (image != null) { JPanel panel = new JPanel(new BorderLayout(10, 10)); panel.add(new JLabel(fc.getSelectedFile().toString()), BorderLayout.NORTH); panel.add(new JLabel(new ImageIcon(image))); JOptionPane.showMessageDialog(frame, panel); } } catch (Exception ex) { ex.printStackTrace(); } } }); frame.add(loadButton); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); }
From source file:ChapterSectionPDF.java
public static void main(String[] args) { Document document = new Document(PageSize.A4, 50, 50, 50, 50); try {/*from www . j a va 2 s. c o m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ChapterSectionPDF.pdf")); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines); document.open(); Font chapterFont = FontFactory.getFont(FontFactory.HELVETICA, 24, Font.NORMAL, new Color(255, 0, 0)); Font sectionFont = FontFactory.getFont(FontFactory.HELVETICA, 20, Font.NORMAL, new Color(0, 0, 255)); Font subsectionFont = FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD, new Color(0, 64, 64)); Paragraph paragraph1 = new Paragraph("text 1"); Paragraph paragraph2 = new Paragraph("text 2"); Paragraph cTitle = new Paragraph("This is a chapter ", chapterFont); Chapter chapter = new Chapter(cTitle, 1); paragraph2.setAlignment(Element.ALIGN_JUSTIFIED); paragraph1.setAlignment(Element.ALIGN_JUSTIFIED); chapter.add(paragraph1); Paragraph sTitle = new Paragraph("This is section 1 in chapter 1", sectionFont); Section section = chapter.addSection(sTitle, 1); section.add(paragraph1); Paragraph subTitle = new Paragraph("This is subsection 1 of section 1", subsectionFont); Section subsection = section.addSection(subTitle, 3); document.add(chapter); } catch (Exception de) { de.printStackTrace(); } document.close(); }
From source file:TableCellHeightPDF.java
public static void main(String[] args) { Document document = new Document(PageSize.A4, 50, 50, 50, 50); try {/*from ww w . ja v a2 s . c o m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("TableCellHeightPDF.pdf")); document.open(); PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.getDefaultCell().setFixedHeight(70); table.addCell("!"); table.addCell("Text Text Text Text Text Text "); table.addCell(new Phrase(new Chunk("cell"))); table.addCell("Text Text "); table.addCell(new Phrase(new Chunk("cell"))); table.addCell("Text Text Text "); table.addCell(new Phrase(new Chunk("cell"))); table.addCell("Text \nText \nText "); table.addCell(new Phrase(new Chunk("cell"))); table.addCell("Text "); table.addCell(new Phrase(new Chunk("cell"))); table.addCell("Text "); table.addCell(new Phrase(new Chunk("cell"))); table.addCell("Text "); table.addCell(new Phrase(new Chunk("cell"))); document.add(table); } catch (Exception de) { de.printStackTrace(); } document.close(); }
From source file:DemoGetGeneratedKeysMySQL.java
public static void main(String[] args) throws Exception { Connection conn = getConnection(); Statement stmt = null;/*from w w w . ja v a 2 s . c o m*/ ResultSet rs = null; try { conn = getConnection(); stmt = conn.createStatement(); stmt.executeUpdate("insert into animals_table (name) values('newName')"); rs = stmt.getGeneratedKeys(); while (rs.next()) { ResultSetMetaData rsMetaData = rs.getMetaData(); int columnCount = rsMetaData.getColumnCount(); for (int i = 1; i <= columnCount; i++) { String key = rs.getString(i); System.out.println("key " + i + " is " + key); } } } catch (Exception e) { e.printStackTrace(); System.exit(1); } finally { try { rs.close(); stmt.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } }
From source file:com.yumfee.extremeworld.QuickStartServer.java
public static void main(String[] args) throws Exception { // Springprofile Profiles.setProfileAsSystemProperty(Profiles.DEVELOPMENT); System.out.println(DateUtils.getTodayBeginDate().toString()); // ?Jetty//from ww w.ja v a 2 s. co m Server server = JettyFactory.createServerInSource(PORT, CONTEXT); JettyFactory.setTldJarNames(server, TLD_JAR_NAMES); try { server.start(); System.out.println("[INFO] Server running at http://localhost:" + PORT + CONTEXT); System.out.println("[HINT] Hit Enter to reload the application quickly"); // ?. while (true) { char c = (char) System.in.read(); if (c == '\n') { JettyFactory.reloadContext(server); } } } catch (Exception e) { e.printStackTrace(); System.exit(-1); } }
From source file:GetNumberOfRowsScrollableResultSet_MySQL.java
public static void main(String[] args) { Connection conn = null;//from w w w. j ava2s . c om Statement stmt = null; ResultSet rs = null; try { conn = getConnection(); String query = "select id from employees"; stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(query); // extract data from the ResultSet scroll from top while (rs.next()) { String id = rs.getString(1); System.out.println("id=" + id); } // move to the end of the result set rs.last(); // get the row number of the last row which is also the row count int rowCount = rs.getRow(); System.out.println("rowCount=" + rowCount); } catch (Exception e) { e.printStackTrace(); } finally { try { rs.close(); stmt.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } }