I've got a Java project that uses several native DLLs but only uses System.load() to load one of them, and it's dependent on the others. I'm not allowed to modify that code. System.load() looks in java.library.path, which I can set via a command line parameter, but according to the top answer in Java JNI and dependent libraries on Windows the loading of dependent DLLs is done by Windows, which only cares about PATH, not java.library.path. So I'd need to add the directory that has the DLLs to PATH, and it'd be lovely to do that via command line parameters as well. Can it be done this way?
Edit for clarification: I'm running my code from Eclipse as a jUnit plug-in test, and I'm trying to figure out how to change the run configuration to get this effect. I changed java.library.path by adding the following to the VM arguments box in the Arguments tab:
-Djava.library.path="D:/prototype/resources/nativelib/x64;${system_property:java.library.path}"
D:/prototype/resources/nativelib/x64 is, of course, the directory where the DLLs are stored.
I tried adding
-Dpath "D:/prototype/resources/nativelib/x64;${system_property:path}"
or
-DPATH "D:/prototype/resources/nativelib/x64;${system_property:PATH}"
in the same place, but neither of them got the desired result.