pdf渲染器运行时异常java.lang.NoClassDefFoundError:com/sun/pdfview/PDFFile
我已经将pdf-renderer-1.0.5.jar作为外部jar添加到我的JavaGWT项目中。 在以下代码中访问“PDFFile PDFFile=new PDFFile(buf);”时,我得到 java.lang.NoClassDefFoundError:com/sun/pdfview/PDFFile运行时异常pdf渲染器运行时异常java.lang.NoClassDefFoundError:com/sun/pdfview/PDFFile,java,gwt,noclassdeffounderror,runtimeexception,Java,Gwt,Noclassdeffounderror,Runtimeexception,我已经将pdf-renderer-1.0.5.jar作为外部jar添加到我的JavaGWT项目中。 在以下代码中访问“PDFFile PDFFile=new PDFFile(buf);”时,我得到 java.lang.NoClassDefFoundError:com/sun/pdfview/PDFFile运行时异常 private static PDFFile getPdfFile(String filepath) throws Exception{ RandomAccessFile r
private static PDFFile getPdfFile(String filepath) throws Exception{
RandomAccessFile raf = new RandomAccessFile(new File(filepath), "r");
FileChannel fc = raf.getChannel ();
ByteBuffer buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size ());
PDFFile pdffile1 = new PDFFile(null);
PDFFile pdfFile = new PDFFile (buf);
return pdfFile;
}
这是什么原因?我不确定我做错了什么
(我试图从以下位置运行示例:
)
谢谢首先在properties-->java构建路径中添加pdf.render库,然后添加外部jar pdf-render.jar,然后应用并关闭,然后检查它是否存在于部署程序集中如果是,则没有问题其他明智的加载项属性-->部署程序集我通过这种方式在DevMode中解决了它?一旦部署到servlet容器?JAR在
WEB-INF/lib
中吗?我在eclipse中创建了一个GWT项目。JAR位于“引用库”中,我尝试将其移动到WEB-INF/lib目录,但仍然得到相同的结果。我对GWT有点陌生,所以我不确定你说的servlet容器是什么意思。我试图运行以下示例:如果您在这个答案中添加一些屏幕截图,那就太好了。