servlet如何调用native的dll
----
在命令行下用Main调用dll是成功的,但在Servlet(JSP)中调用始终出错
服务器 Tomcat 4.0.1
----
1.TestNative.java
package native
public class TestNative {
public static native int add( int a,int b );//dll里的方法
static
{
System.loadLibrary( "TestNativeImpl" );//装载TestNativeImpl
}
}
2.servlet
import native.*;
public class TestNativeServlet extends BaseServlet implements SingleThreadModel
{
TestNative obj=new TestNative();
public void doService(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException
{
try
{
int a=obj.add(12,14);
System.out.println(""+a);
}
运行的时候报了如下的错误,请指教
Root cause of ServletException.
java.lang.UnsatisfiedLinkError: add
at native.add(Native Method)