Reputation: 3497
I'm having a problem with trying to get Maven to load my native library. Currently, I placed my library file (.so) in src/main/resources/
and it gives me an error of it cannot be found in java.library.path. I also tried to place this in my base directory of the project, but gives me the same results.
Below is the maven plugin I tried, but it doesn't seem to work.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<name>java.library.path</name>
<value>${project.build.directory}</value>
</property>
</systemProperties>
</configuration>
</plugin>
If it helps, I run my project directly from Eclipse. I know how to get it to work in Eclipse but want it to work with maven.
@EDIT I also tried running it on the command line and I still receive the same mistakes
Upvotes: 4
Views: 8303
Reputation: 2460
I did the following in my project:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Djava.library.path=/path/to/your/libs:${java.library.path}</argLine>
</configuration>
</plugin>
</plugins>
And it worked for me that way.
Upvotes: 3