我试图在Eclipse中从https://bitbucket.org/madsen953/ethervisu创建一个可运行的JAR。当我尝试运行它时,我得到:
Exception in thread "Monitor" java.lang.UnsatisfiedLinkError: no jnetpcap in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.jnetpcap.Pcap.<clinit>(Unknown Source)
at ethervisu.monitors.JNetPcapMonitor.run(JNetPcapMonitor.java:28)
at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
at java.io.DataInputStream.readInt(DataInputStream.java:387)
at processing.core.PFont.<init>(Unknown Source)
at processing.core.PApplet.loadFont(Unknown Source)
at jgv.graphics.JGVGraphics$GraphVisuApplet.setup(JGVGraphics.java:80)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "Animation Thread" java.lang.RuntimeException: Could not load font /data/ArialMT-48.vlw. Make sure that the font has been copied to the data folder of your sketch.
at processing.core.PApplet.die(Unknown Source)
at processing.core.PApplet.die(Unknown Source)
at processing.core.PApplet.loadFont(Unknown Source)
at jgv.graphics.JGVGraphics$GraphVisuApplet.setup(JGVGraphics.java:80)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
我认为这是因为我在创建JAR时无法保留目录结构。字体文件位于根目录而不是data
目录。我该如何解决这个问题?
答案 0 :(得分:0)
尝试检查JDK集的路径是否正确指向buildpath中正确的java库。
并确保安装了正确的jdk版本。没有搞乱x86 / x64安装。
答案 1 :(得分:0)
解决方法是将字体文件放在名为data
的目录中,并与jar一起运行,并使用java -Djava.library.path=jnetpcap-1.3.0 -jar thejar.jar
运行它,其中jnetpcap-1.3.0
是jnetpcap及其关联的目录.so
居住。