Helo everyone。 我想在Windows命令提示符下运行我的应用程序,但是我遇到了问题。
当我输入:
"C:\Users\Stefano>java -jar "C:\Users\Stefano\Desktop\My app\My app\dist\My_app.jar"
我收到了:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: com.slyte
chs.library.NativeLibrary.dlopen(Ljava/lang/String;)J
at com.slytechs.library.NativeLibrary.dlopen(Native Method)
at com.slytechs.library.NativeLibrary.<init>(Unknown Source)
at com.slytechs.library.JNILibrary.<init>(Unknown Source)
at com.slytechs.library.JNILibrary.loadLibrary(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at org.jnetpcap.Pcap.<clinit>(Unknown Source)
at my.sniffer.Interface.<init>(interfaceNetwork.java:19)
at my.sniffer.SnifferGUI.<init>(SnifferGUI.java:45)
at my.sniffer.SnifferGUI$9.run(SnifferGUI.java:361)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$300(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)
我知道查找库(外部?)存在问题。我使用jnetpcap,我在netbeans中使用Run-&gt; Set Project Configuration-&gt; VM选项显示:"-Djava.library.path="C:\Users\Stefano\Desktop\Java libs\jnetpcap-1.4"
。还安装了Winpcap。应该在何处以及如何将此库放在应用程序jar文件中以使其可见?或者问题可能有所不同?
我的目标是在任何计算机上使用jar文件(不带IDE,如果需要,使用lib)运行应用程序。