我正在尝试构建一个使用外部库的Java桌面应用程序。
该项目在ide jdeveloper 12c中工作正常,但是当我这样做时,部署会显示我
错误:发生了JNI错误,请查看您的安装并尝试使用agan。线程" main"中的例外情况java.lang.NoClassDefFoundError:orf / icepdf / core ..
我在项目properties -> Deployment -> Profile Tupe: JAR File -> Main Class: My class -> File Groups -> New Packaging -> Contributors -> Add My jars
中创建了部署。
我还尝试在项目properties -> Deployment -> Profile Tupe: JAR File -> Main Class: My class -> File Groups -> New Libraries
中创建部署,但在这两种情况下我都收到错误。
编辑:错误附近的代码:
public static void setup() throws IOException {
JFrame frame = new JFrame("PDF Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
PagePanel panel = new PagePanel(); frame.add(panel);
frame.pack();
frame.setVisible(true);
File file = new File("c://test.pdf");
RandomAccessFile raf = new RandomAccessFile(file, "r");
FileChannel channel = raf.getChannel();
ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
PDFFile pdffile = new PDFFile(buf);
PDFPage page = pdffile.getPage(0);
panel.setClip(null);
panel.useZoomTool(true);
panel.showPage(page);
}
错误:
C:\JDeveloper\mywork\borrar4\Client\deploy>java -jar archive3.jar
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/sun/p
dfview/PDFPage
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
at java.awt.Component.access$500(Unknown Source)
at java.awt.Component$3.run(Unknown Source)
at java.awt.Component$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Unknown Source)
at java.awt.Component.<init>(Unknown Source)
at java.awt.Container.<init>(Unknown Source)
at javax.swing.JComponent.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at client.PagePanel.<init>(PagePanel.java:77)
at client.VerPdfSimplePage.setup(VerPdfSimplePage.java:29)
at client.VerPdfSimplePage$1.run(VerPdfSimplePage.java:57)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.pdfview.PDFPage
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 32 more
C:\JDeveloper\mywork\borrar4\Client\deploy>
在JDeveloper IDE 12c中运行完美,问题是开发部署。当我通过CMD控制台运行生成的jar时给出了错误。 jdeveloper 11可以选择开发部署&#34; Dependency Analysys&#34;在jdeveloper 12c中我找不到该选项。