Java Problem “UnsatisfiedLinkError”

前端 未结 5 950
遥遥无期
遥遥无期 2020-12-11 13:38

I made a simple java program that sends bytes to the parallel port, which uses a .dll along with two other classes (pPort.java and ioPort.java) to accomplish it, and it work

5条回答
  •  眼角桃花
    2020-12-11 13:46

    An UnsatisfiedLinkError message typically indicates that the library path is set but does not include the library that you are trying to load. On Windows platforms, you should extend the PATH using

    PATH = %PATH%;C:\path_to_dll_file 
    

    On UNIX platforms, you should extend the library path using

    setenv LD_LIBRARY_PATH mylibrarypath 
    

    However, as far as I can remember (I'm not under Windows), System32 is in the PATH so I suspect NetBeans to overwrite it by settings its own PATH.

    To solve this on NetBeans, you might want to check http://wiki.netbeans.org/DevFaqNativeLibraries which is mentioned in this message from Wade Chandler, a NetBeans Dream Team Member ;-)

    PS: You can also use the java.library.path system property but keep in mind that this system property only works to resolve the immediate native library that you are loading in your code. Loading of other dependent libraries is left to the first library. The JNI library that you load will rely on the OS dependent way to resolve its references (this applies to the solution of the FAQ too IMO so I'm still not 100% convinced its a good solution).

提交回复
热议问题