Example usage for java.lang Exception getMessage

List of usage examples for java.lang Exception getMessage

Introduction

In this page you can find the example usage for java.lang Exception getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:Main.java

public static void main(String args[]) {
    Callable<String> c = () -> "Hello you!";
    try {//  ww w.j  a  va 2s  .c  om
        System.out.println(c.call());
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}

From source file:TrueTypeCollectionsPDF.java

public static void main(String[] args) {
    try {/*  w w w .  j  a  va2  s .  c om*/
        String[] names = BaseFont.enumerateTTCNames("c:\\windows\\fonts\\msgothic.ttc");
        for (int i = 0; i < names.length; i++) {
            System.out.println("font " + i + ": " + names[i]);
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
}

From source file:iTextVersion.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from   w ww.j  a va2s  .com*/
        PdfWriter.getInstance(document, new FileOutputStream("Version.pdf"));
        document.open();
        document.add(new Paragraph("This page was made using " + Document.getVersion()));
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:PdfVersion1_2.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  w  w  w  .  j av a  2 s  .c o m
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PDFversion1_2.pdf"));
        writer.setPdfVersion(PdfWriter.VERSION_1_2);
        document.open();
        document.add(new Paragraph("This is a PDF-1.2 document"));
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:ExtraStyleSTRIKETHRUPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  w  w  w. ja va  2  s . c om
        PdfWriter.getInstance(document, new FileOutputStream("ExtraStyleSTRIKETHRUPDF.pdf"));
        document.open();

        document.add(new Chunk("underline",
                FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.STRIKETHRU)));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:FontStyle3PDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from   w ww  . j  av a 2 s.c o m
        PdfWriter.getInstance(document, new FileOutputStream("FontStyle3PDF.pdf"));
        document.open();
        Phrase myPhrase = new Phrase("FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD)",
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
        document.add(myPhrase);
    } 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 ww.  j  a  v  a2  s  .  co m
        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:ImagesWMFPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from w w  w. j a v  a2 s  .co  m
        PdfWriter.getInstance(document, new FileOutputStream("ImagesWMFPDF.pdf"));
        document.open();

        document.add(new Paragraph("load a WMF image file"));
        Image img = Image.getInstance("logo.WMF");
        document.add(img);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:ImagesPNGPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  w w  w . j av  a2 s  . com
        PdfWriter.getInstance(document, new FileOutputStream("ImagesPNGPDF.pdf"));
        document.open();

        document.add(new Paragraph("load a png image file"));
        Image img = Image.getInstance("logo.png");
        document.add(img);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:ImagesJPGPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  w  ww. j a  v a2s.c o m*/
        PdfWriter.getInstance(document, new FileOutputStream("ImagesJPGPDF.pdf"));
        document.open();

        document.add(new Paragraph("load a jpg image file"));
        Image jpg = Image.getInstance("logo.jpg");
        document.add(jpg);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}