Off the top of my end the Eclipse "run configuration" should set
-Djava.library.path BEFORE it get's to m2eclipse/maven. Same as it would do
for a non maven run configuration. So look at the options under the eclipse
run configurations :)


On Thu, Apr 22, 2010 at 4:41 AM, Jon Kristensen <[email protected]>wrote:

> Hi!
>
> That helped me a lot! I have realized that the problem was neither in
> Maven or in m2eclipse. I assumed a native library on the classpath would
> be loadable by System.loadLibrary(). I now extract the libraries in the
> target/natives directory by using the maven-dependency-plugin:
>
> <plugin>
>        <inherited>true</inherited>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-dependency-plugin</artifactId>
>        <executions>
>                <execution>
>                        <id>unpack</id>
>                        <phase>compile</phase>
>                        <goals>
>                                <goal>unpack</goal>
>                        </goals>
>                        <configuration>
>                                <artifactItems>
>                                        <artifactItem>
>                                                <groupId>org.lwjgl</groupId>
>
>  <artifactId>lwjgl-linux-64</artifactId>
>                                                <version>2.4.2</version>
>
>  <classifier>natives</classifier>
>                                                <type>jar</type>
>                                                <overWrite>true</overWrite>
>
>  <outputDirectory>target/natives</outputDirectory>
>
>  <includes>*.so,*.dylib,*.dll</includes>
>                                        </artifactItem>
>                                        <artifactItem>
>
>  <groupId>net.java.games</groupId>
>
>  <artifactId>jinput</artifactId>
>                                                <version>2.0.1</version>
>
>  <classifier>linux-natives</classifier>
>                                                <type>jar</type>
>                                                <overWrite>true</overWrite>
>
>  <outputDirectory>target/natives</outputDirectory>
>
>  <includes>*.so,*.dylib,*.dll</includes>
>                                        </artifactItem>
>                                </artifactItems>
>                        </configuration>
>                </execution>
>        </executions>
> </plugin>
>
> The only problem now is setting java.library.path as an m2eclipse
> setting somehow.
>
> Thanks so very much for your help!
>
> /Jon
>
> On Tue, 2010-04-20 at 21:24 +0930, Andrew Hughes wrote:
> > I'm no expert but I'll try to help.
> >
> > The big question is how are you running your application, is there a
> > specific maven goal/plugin you can speak of? If this is in the same JVM
> as
> > maven then you'll need to kick maven off with an extra command line
> > argument. If maven fork's the execution off to a system exec process then
> > it'll be on a different jvm.
> >
> > But, this is really a JVM issue and not maven. Classloaders are
> irrelevant,
> > you will get only one java.library.path per jvm that shouldn't be
> modified
> > at runtime (but it can be hacked).
> >
> > If you want this to work inside and out outside eclipse, then you might
> be
> > able to set -Djava.library.path in the MAVEN_OPTS environment param.
> There's
> > probably a few ways todo this too.
> >
> > If you only want this to work in eclipse, then I think there are
> parameters
> > and jvm arguments that you can add to the run configuration.
> Specifically,
> > set -Djava.library.path
> >
> > Another idea, that I don't like but can be used as a fallback is...If you
> > can work out at runtime the absolute path of dll/so then you can do
> > System.load(); instead of System.loadLibrary(). But that's not always an
> > option.
> >
> > Sorry I can't offer you a perfect howto.
> >
> >
> > On Sun, Apr 18, 2010 at 10:08 PM, Jon Kristensen <[email protected]
> >wrote:
> >
> > > Hello people!
> > >
> > > I need some kind of native library support in m2eclipse.
> > >
> > > Maven is compiling and packaging my project nicely but in order to let
> > > m2eclipse handle the dependency management and run my application from
> > > within Eclipse I need the so/dll etc files to be put on the classpath
> > > and possibly also java.library.path to be set.
> > >
> > > Does maven deal with native library files in any special way? Also, do
> > > you have any suggestions on how this feature should work?
> > >
> > > Thank you in advance!
> > >
> > > Warm regards,
> > >
> > > --
> > > Jon Kristensen <[email protected]>
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > >
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to