I have a .dll for example "example.dll" and I know that this dll is in one of the pat开发者_运维百科hs specified in java.library.path, there is a simple way to get the dll's path without executing a cicle on this list of paths?
A loop sounds simple to me.
for(String dir: System.getProperty("java.library.path").split(File.pathSeparator))
if(new File(dir, "example.dll").isFile())
// found directory
No. You can't. The DLL's are not a Java's fully supported "type" so I am not sure even about the GAC approach. You have to iterate and find.
精彩评论