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 ww . java 2 s . c o m*/ PrintWriter pw = new PrintWriter("c:/text.txt", "ACSII"); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {/*from ww w. j a va2 s .co m*/ PrintWriter pw = new PrintWriter(new File("c:/text.txt")); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:be.anova.course.camel.basic.Main.java
public static void main(String[] args) { try {//w w w .java 2 s .com ApplicationContext context = new ClassPathXmlApplicationContext("context.xml"); Thread.sleep(60000); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {/*from ww w . j a v a 2 s . co m*/ InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.isBound()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {/*from w ww . j a v a 2 s. co m*/ InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getRemoteSocketAddress()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {/*from ww w .j av a2s . c o m*/ InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getBroadcast()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {/*from w ww . j a va2 s . com*/ InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getInetAddress()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {// w ww . j a v a2 s . c o m InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getSendBufferSize()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {//from w w w . java2 s. c o m PrintWriter pw = new PrintWriter(new FileWriter("c:/text.txt")); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:CopyPDFFileAndAddMetaData.java
public static void main(String[] args) { try {/* www . j ava 2s . c o m*/ PdfReader reader = new PdfReader("YourOwnPDF.pdf"); PdfStamper stamp = new PdfStamper(reader, new FileOutputStream("NewPDFFileFromPdfStamper.pdf")); HashMap<String, String> moreInfo = new HashMap<String, String>(); moreInfo.put("Author", "YourName"); moreInfo.put("Title", "YourTitle"); moreInfo.put("Subject", "YourSubject"); stamp.setMoreInfo(moreInfo); stamp.close(); } catch (Exception de) { de.printStackTrace(); } }