0

I'm getting a

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/JPEGImageDecoder

When using the ICEPDF like it's used here Java PDF Viewer

It has worked previously, there's been no change in any code of this part of the project, since we've been busy with other parts and I've also reset it, didn't fix the issue. Now the first thing I tried after realising it's part of the jre and is also included in my jre, was updating the version since it's not the latest version. That gave me another issue, namely a fieldnotfound exception.

Exception in thread "main" java.lang.NoSuchFieldError: BORDER_STYLE_SOLID

The right jars are included as stated in the stackoverflow post (iceviewer & the core one).

 public PdfViewer(String path){
    SwingController controller = new SwingController();
    SwingViewBuilder factory = new SwingViewBuilder(controller);

    JPanel viewerComponentPanel = factory.buildViewerPanel();

    controller.getDocumentViewController().setAnnotationCallback(
            new org.icepdf.ri.common.MyAnnotationCallback(
                    controller.getDocumentViewController()));

    JFrame applicationFrame = new JFrame();
    applicationFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    applicationFrame.getContentPane().add(viewerComponentPanel);

    controller.openDocument(path);

    applicationFrame.pack();
    applicationFrame.setVisible(true);
}
Beast Julian
  • 63
  • 10
  • There was likely a Java update as the class in question no longer ships with Java. I would recommend updating your icepdf libs as the issue has been fixed for quite some time. – pcorless Feb 02 '19 at 10:22
  • @pcorless Thanks, Like I've mentioned, I've updated the IcePdf libs to 6.2.2 but that resulted in the other exception. You might have thought I meant that I updated java :) – Beast Julian Feb 02 '19 at 13:52

0 Answers0