开发者

How to link class with jar file in the war? (Java)

I have war file. It contains the following files:

Applet1.class
jna-3.2.3.jar
SomeClass.class

Applet1 class imports com.sun.jna.* from jna-3.2.3.jar and uses some functions from SomeClass.

When I load applet on the web page the error arise:

java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jna/Pointer. 

That is Applet1.class sees SomeClass.class but does not see jna-3.2.3.jar. How to fix it?

And one more question. jna-3.2.3.jar is loaded to the client, isnt it?Applet1.classdoesnt call jna-3.2.3.jar from server every time? Or maybe Applet1.class tries to开发者_运维技巧 find jna-3.2.3.jar on the client side?


You need to specify that the applet needs the jna-3.2.3.jar using the archive attribute of the applet HTML tag. See http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html#edef-APPLET and http://mindprod.com/jgloss/applet.html#APPLETTAGS for details.


The jar file must be under WEB-INF/lib in the WAR.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜