diff --git a/bindings/java/src/net/hyperic/sigar/SigarLoader.java b/bindings/java/src/net/hyperic/sigar/SigarLoader.java index 9f9c8d0e..8941b93d 100644 --- a/bindings/java/src/net/hyperic/sigar/SigarLoader.java +++ b/bindings/java/src/net/hyperic/sigar/SigarLoader.java @@ -8,6 +8,7 @@ import net.hyperic.jni.ArchNotSupportedException; public class SigarLoader extends ArchLoader { private static String location = null; + private static String nativeName = null; public SigarLoader(Class loaderClass) { super(loaderClass); @@ -52,4 +53,21 @@ public class SigarLoader extends ArchLoader { } return location; } + + /** + * Returns the name of the native sigar library. + */ + public synchronized static String getNativeLibraryName() { + if (nativeName == null) { + SigarLoader loader = new SigarLoader(Sigar.class); + + try { + nativeName = loader.getLibraryName(); + } catch (ArchNotSupportedException e) { + nativeName = null; + } + } + + return nativeName; + } }