Nick Fortescue
Nick Fortescue

Reputation: 44163

How can you find where System.loadLibrary() is finding a library?

Can you find out where System.loadLibrary() is finding a DLL from, with either Java method calls or windows tools?

We have some code we expect to fail as it loads a native Library with System.loadLibrary() and it unexpectedly succeeds! We think we have removed all copies of the relevant DLL from the PATH, and removed the java.library.path argument, but somehow the code still succeeds. We've rebooted the machine (to make sure it isn't lurking in memory). We must be doing something stupid, but are having trouble working out what.

Upvotes: 4

Views: 5399

Answers (2)

mtraut
mtraut

Reputation: 4740

Doesn't ProcessExplorer show you which DLL's are loaded and from where?


Edit from OP.

ProcessExplorer does. Run it, and then do "search" to find your dll. It will show all processes it is attached to - your java process should be one of them. The "handle or dll" line will also give a complete path to where the DLL is found.

Upvotes: 3

Jigar Joshi
Jigar Joshi

Reputation: 240900

Try System.getProperty("java.library.path");

if your lib is placed in one of these place then it will be looked up

Upvotes: 2

Related Questions