I want to specify vm args of -Djava.library.path=./src/main/resources so that a dll is picked up automatically, and I want to specify this in maven, so other developers don't have to manually configure eclipse.
I was thinking perhaps the the maven eclipse plugin might help, so I could do something like
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
DO MAGIC HERE ???? <<-----
</configuration>
</plugin>
But I can't see a way to add VM args from within the plugin.
I have fixed this for running my tests via maven at the command line by
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<argLine>-Xmx768m -Xms128m -Djava.library.path=${basedir}/src/main/resources/</argLine>
</configuration>
</plugin>
My current solution, is that I will have to tell the developers to add this manually to eclipse which doesnt seem very good.
Has anybody got any ideas as to how to solve this.
cheers,
David.
Maybe this should be a more general question:
Is there any way of adding a DLL to the VM without having to specify it through the library path?
I've read somewhere that putting the dll in the application root and specifying the DLL in the MANIFEST.MF with its hashcode triggers the VM to automatically pick it up. That could be completely wrong though.
My interpretation of your problem is that your application is loading a DLL and this DLL is located in your project in the resources folder. Correct?
You can get the full path of the DLL if the DLL is inside a folder in the class path and load it using:
// assuming dll is located in the default package
URI dllUri = this.getClass().getResource("/mydll.dll").toURI();
File dllFile = new File(dllUri);
System.load(dllFile.getCanonicalPath());
This is independent of maven. There are only two problems:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With