0

The System.loadLibrary("Something") will load libSomething.so or Something.dll depending on platform. It will search for it in a list of directories (java.library.path) and will load the first it finds (I think).

I would like to know the full path of the loaded .so / .dll. There is ClassLoader.findLibrary(String libname) which does exactly what I want, but it is protected.

A workaround option could be to use System.mapLibraryName(String) to make platform specific file name from the library name and then to split and iterate through the java.library.path system property. I suppose it would give the same result as ClassLoader.finLibrary for most cases, but would it for all cases?

Is there any best practice for this task?

user2864740
  • 60,010
  • 15
  • 145
  • 220
Notinlist
  • 16,144
  • 10
  • 57
  • 99
  • If the `ClassLoader` method is good, inherit `ClassLoader` and add a public method that just calls the protected one. – PurkkaKoodari Jun 26 '14 at 08:45
  • check out http://stackoverflow.com/questions/9551588/can-i-find-out-what-variable-java-library-path-maps-to-on-the-current-platform – Gubatron Jun 26 '14 at 09:07

0 Answers0