Reputation: 106381
I'm trying to get some native dependencies (LWJGL) working smoothly in Eclipse (Juno) with Maven.
Current situation:
maven-nativedependencies-plugin
version 0.0.6. This seems to successfully download and unpack the native libraries to the target/natives
subdirectory of my project. Fine so far.target/natives
directory in Properties / Java Build Path / Maven Dependencies / Native Library Location / Edit...
Maven / Update Project...
because the Native Library Location is cleared (presumably by m2e re-configuring the project according to the pom)What is the best way to get this working reliably?
Upvotes: 4
Views: 7031
Reputation: 41
Actually, you can copy your dll to any directory on the PATH variable, ex: C:\Windows\System32. This way, you don't have to add the argument in the VM arguments tab in Eclipse.
Upvotes: 0
Reputation: 41
In my application, I need sqljdbc4.jar from MS. My project is a Maven project, so I had the same problem that I could not edit Native Library Location under sqljdbc4.jar in Eclipse.
My error is this:
Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
So I added this:
-Djava.library.path="C:\Documents and Settings\ccrhlj01\My Documents\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\auth\x86"
in my VM arguments.
-Djava.library.path="C:\Documents and Settings\ccrhlj01\My Documents\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\auth\x86"
into the VM Arguments.Remember the quotation marks around the path. In my case, that is my location, you need to find your dll location.
Upvotes: 4
Reputation: 6738
Try this steps;
For maven project;
Make sure your pom.xml like this;
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.googlecode.mavennatives</groupId>
<artifactId>maven-nativedependencies-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<id>unpacknatives</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<mainClass>${main.class}</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>bundle-project-sources</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/META-INF/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
And then left click on the eclipse project, go to the maven menu and click on "update project configuration". If you are still having problems, in the eclipse console tab, open the maven console and do the "update project configuration" option again
Upvotes: 5