如何在Eclipse / Java中使用DLL

时间:2019-04-01 11:26:11

标签: java eclipse dll

我一直在尝试使用JNA将C ++ dll导入到Eclipse上的Java项目中,但是遇到一些错误。

这是我的代码:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub

        String button = request.getParameter("button");

        if("Cancel".equals(button)) {  --> not working 
            String page = "list_users.jsp"; 
            RequestDispatcher dispatcher = request.getRequestDispatcher(page);
            dispatcher.forward(request, response);
        }

这是我遇到的错误:

package DLLs.Release;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Platform;
import com.sun.jna.*;
public class test {

package DLLs.Release;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Platform;
import com.sun.jna.*;
public class test {


    public interface simpleDLL extends Library {
        simpleDLL INSTANCE = (simpleDLL) Native.loadLibrary(
            (Platform.isWindows() ? "Tdf2ParsersWrapper" : "simpleDLLLinuxPort"), simpleDLL.class);

         Object TDF2ParserWrapper(); 
    }

    public Object testParser()
    {
        simpleDLL sdll = simpleDLL.INSTANCE;
        Object a = sdll.TDF2ParserWrapper();
        return a;
    }
}

我尝试了不同的方法在Eclipse / Java项目中导入C ++ dll,但没有一个起作用。

注意:我不知道DLL中的所有功能。

0 个答案:

没有答案