私は取得しています
スレッド「メイン」の例外 java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/JPEGImageDecoder
ここで使用されているようにICEPDFを使用する場合Java PDF Viewer
以前は機能していましたが、プロジェクトのこの部分のコードに変更はありません。他の部分で忙しく、リセットしたため、問題は修正されませんでした。それがjreの一部であり、私のjreにも含まれていることに気付いた後、最初に試したのは、最新バージョンではないため、バージョンを更新することでした。これにより、別の問題、つまり fieldnotfound 例外が発生しました。
スレッド「メイン」の例外 java.lang.NoSuchFieldError: BORDER_STYLE_SOLID
stackoverflow の投稿 (iceviewer & the core one) に記載されているように、適切な jar が含まれています。
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);
}