Add .dll to java.library.path in Eclipse/PyDev Jython project
I got this working.
For future reference:
Say the dll you need is in Y:\path\to\dlls\lib\
. Then set your Run Configuration's working directory to Y:\path\to\dlls\
and set your VM arguments to include -Djava.library.path=lib
.
That's it, it should now work. I don't know why specifying an absolute path in java.library.path
didn't work previously, but setting a working directory seems to have done it.
Perhaps it's something peculiar to the specific library I'm using (or that Eclipse is running from a different drive than the library is on)...
I think the better way is:
- Create a folder under the project, for example dll.
- Copy/paste all dll files into this folder.
- In project -> Properties -> Java Build Path -> Source, click and expand the source details.
- You will see Native library location, click/highlight it.
- Then click edit on the right, click workspace again. You can see the dll folder under the project.
- Select it and click OK, OK. You will see the dll is added in the Native library location.
That's it. You do not need to manually change anything in configuration.