How to configure .dll file in Java?

后端 未结 6 1749
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 22:00

I am using Jacob jar file in my java application.

This Jacob jar file comes with a .dll file. I have added Jacob jar file to my classpath. But when I execute my appl

6条回答
  •  半阙折子戏
    2020-12-16 22:36

    Ah, that's not a compilation error but a runtime error.

    My guess would be that your DLL needs to be on the PATH. Not CLASSPATH, but PATH, because that's where Windows looks for DLLs. Try either extending your PATH to include the location of your DLL, or do what many other people do: Dump the DLL into \Winnt\System\System32 or whatever the system directory is called on your box. Wherever all the other DLLs are, in other words.

    Update

    The error message you post, thankfully, is pointing out the exact problem. You can solve it by putting the directory containing your DLL into java.library.path This Sun forum thread shows a nice example: http://forums.sun.com/thread.jspa?threadID=627890

    Actually, that's a lot less clean than it should be; this seems to be one of the "shadier" areas in Java. The thread wanders around a lot, I do advise you to read all the way through to see some problems and solutions. I think you'll be able to succeed with a little trial and error.

提交回复
热议问题