1

1st, sorry for my english, I'm french but I think it's just the best website for my question !

I'm trying to put two dll in my jar : sigar-amd64-winnt.dll and sigar-x86-winnt.dll

It's a Maven project and the objective is to make an applet for a bigger project, so I can't put it in a system or user folder.

DLLs are in the jar's root, so I can extract and load them with this solution : https://stackoverflow.com/a/4691879/4261971 (They are extracted in the java temp folder). I use the System.setProperty("java.library.path", System.getProperty("java.library.path") + MyLibDirectory) function to reference the dll in the java.library.path, and it's work ! I can see it if I use System.getProperty("java.library.path").

But the error is always the same :

no sigar-x86-winnt.dll in java.library.path at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:172) etc...

Function (simplified) which call the sigar library :

public String getfileVersion(String fileDir) {
    String version = "";
    if ((!fileDir.isEmpty()) && (!"".equals(fileDir))) {
        FileVersion info = Win32.getFileVersion(fileDir);
        version = info.getFileVersion();
    }
    return version;
}

The finality of the applet is to inspect a user computer directly from the global web application and generate a log.

The part of Maven pom.xml for including dlls :

<build>
<resources>
  <resource>
    <directory>libs</directory>
    <includes>
      <include>sigar-amd64-winnt.dll</include>
      <include>sigar-x86-winnt.dll</include>          
    </includes>
  </resource>
</resources>

I worked three working days on this problem and I don't understand my mistake at this time, so if you can help me, I will love you for the rest of my life ! (lol)

If you want more informations, just ask !

Community
  • 1
  • 1

1 Answers1

-1

System.setProperty("java.library.path", System.getProperty("java.library.path") + System.getProperty("path.separator")+ MyLibDirectory); or System.setProperty("org.hyperic.sigar.path",MyLibDirectory);