0

I have a Maven project in Eclipse, where i added the Sigar library using

<dependency>
        <groupId>org.fusesource</groupId>
        <artifactId>sigar</artifactId>
        <version>1.6.4</version>
</dependency>

This was compiling and executing smoothly under eclipse. When i created an executable jar i was getting an error, that the .so file doesn't exist in the java.library.path.

DEBUG Sigar  - no libsigar-amd64-linux.so in java.library.path
org.hyperic.sigar.SigarException: no libsigar-amd64-linux.so in java.library.path

After some research and reading (ok, more than some) i copied the lib folder of sigar (the one that holds all the .so files) under my project (i was not sure if I have to copy it to a specific place, so i put it under the project's root) and changed the maven dependency to that:

<dependency>
        <groupId>org.fusesource</groupId>
        <artifactId>sigar</artifactId>
        <version>1.6.4</version>
        <configuration>
            <workingDirectory>${project.build.directory}/Sigar_lib</workingDirectory>
            <mainClass>my.package.name.MyClass</mainClass>
            <includeProjectDependencies>true</includeProjectDependencies>
        </configuration>            
    </dependency>

Tried all different approaches to the <workingDirectory> tag, with/without the build directory, forward/back slash and so on. Every time the jar fails to execute with the same error.

Any help please? Thank you

Skaros Ilias
  • 1,008
  • 12
  • 40
  • Have you tried to copy/paste the entire "lib" folder (with all the .so and .dll and whatnot) into the folder "main/src/webapp according to http://stackoverflow.com/questions/21894128/how-to-install-sigar-on-ubuntu-based-linux ? – Aurelien Dec 30 '15 at 20:48
  • @Aurelien I have seen that thread, but i dont have such a folder. – Skaros Ilias Dec 30 '15 at 21:34

1 Answers1

0

please consider using Apache Maven Shade plugin in order to build your executable jar. You can configure what kind of resources you want to have in your final Uber jar . See details here

Example

<filter>
      <artifact>*:*</artifact>
       <includes>
            <include>xxx/*.so</include>
      </includes>
 </filter>

Hope that helps.

javapapo
  • 1,342
  • 14
  • 26