문제

i use ghost4j in an java webapplication. This lib loads a dll through JNA. now i want to place the dlls in the classpath, because the working dir of this application changes when i run a test, run it on server with eclipse, or just run a main function for testing purposes.

How can i tell JNA to look in the classpath?

i thought on something like

class.getProtectionDomain().getCodeSource().getLocation().getPath()

but how can i add this programatical to the searchpath? i don't like to add VM arguments

도움이 되었습니까?

해결책

JNA will look in jna.library.path for native libraries, falling back to system defaults (usually the same as java.library.path) if nothing is found there.

System.setProperty("jna.library.path", "/whatever/path/you/want");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top