开发者

How can I get the path of a given dll in java?

开发者 https://www.devze.com 2023-03-10 10:19 出处:网络
I have a .dll for example \"example.dll\" and I know that this dll is in oneof the pat开发者_运维百科hs specified in java.library.path, there is a simple way to get the dll\'s path without executing a

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号