You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Sean Rhea <se...@gmail.com> on 2010/10/17 17:07:09 UTC

Passing -Djava.library.path=target/native to all tasks

Hi,

I'm working on moving a Scala library for accessing sqlite3 to Buildr.
 As this library wraps the C interface to sqlite3, it contains some
JNI code.  On MacOS, the only way to pick up a JNI library is to add
it to the current directory, or to pass a java.library.path property
to the JVM.  I took a look at lib/buildr/scala/shell.rb, and it
doesn't look like there's any way to pass properties to the JVM when
involving the Scala shell.  (At least, not in version 1.4.3.)

I also tried to use ScalaTest with my project, and I added this line
to the buildfile:

  test.using :properties => { "java.library.path" => "target/native" }

But that doesn't seem to pick up the library, either.

If I run this from the command line, it works fine:

  scala -classpath target/classes -Djava.library.path=target/native Test

What am I missing?

Thanks in advance,
Sean
-- 
"I refuse to accept the idea that the ‘isness’ of man’s present nature
makes him morally incapable of reaching up for the eternal ‘oughtness’
that forever confronts him." --MLK

Re: Passing -Djava.library.path=target/native to all tasks

Posted by Alex Boisvert <al...@gmail.com>.
I've created the following enhancement trackers following this discussion,

Shell tasks should use JAVA_OPTS by default
https://issues.apache.org/jira/browse/BUILDR-537

<https://issues.apache.org/jira/browse/BUILDR-537>
Shell tasks should support passing :java_args
https://issues.apache.org/jira/browse/BUILDR-538

ScalaTest should support :fork option
https://issues.apache.org/jira/browse/BUILDR-539

<https://issues.apache.org/jira/browse/BUILDR-539>
alex

On Sun, Oct 17, 2010 at 9:17 AM, Alex Boisvert <al...@gmail.com>wrote:

> Hi Sean,
>
> ScalaTest currently runs test in the same VM as Buildr (through RJB if
> you're using MRI) so it's too late to pass the java.library.path through
> test.using.
>
> (Incidentaly, we should probably add support for the :fork option for
> ScalaTest).
>
> To get the library path set up correctly with RJB, either set the JAVA_OPTS
> environment variable before invoking Buildr,
>
> export JAVA_OPTS=-Djava.library.path=...
>
> or put the following at the top of your Buildfile,
>
> ENV["JAVA_OPTS"] = "-Djava.library.path=..."
>
> alex
>
> On Sun, Oct 17, 2010 at 8:07 AM, Sean Rhea <se...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm working on moving a Scala library for accessing sqlite3 to Buildr.
>>  As this library wraps the C interface to sqlite3, it contains some
>> JNI code.  On MacOS, the only way to pick up a JNI library is to add
>> it to the current directory, or to pass a java.library.path property
>> to the JVM.  I took a look at lib/buildr/scala/shell.rb, and it
>> doesn't look like there's any way to pass properties to the JVM when
>> involving the Scala shell.  (At least, not in version 1.4.3.)
>>
>> I also tried to use ScalaTest with my project, and I added this line
>> to the buildfile:
>>
>>  test.using :properties => { "java.library.path" => "target/native" }
>>
>> But that doesn't seem to pick up the library, either.
>>
>> If I run this from the command line, it works fine:
>>
>>  scala -classpath target/classes -Djava.library.path=target/native Test
>>
>> What am I missing?
>>
>> Thanks in advance,
>> Sean
>> --
>> "I refuse to accept the idea that the ‘isness’ of man’s present nature
>> makes him morally incapable of reaching up for the eternal ‘oughtness’
>> that forever confronts him." --MLK
>>
>
>

Re: Passing -Djava.library.path=target/native to all tasks

Posted by Sean Rhea <se...@gmail.com>.
That works perfectly for ScalaTest.  Thanks, Alex!

I'll keep an eye on BUILDR-537 for my issue with buildr shell.

Sean



On Sun, Oct 17, 2010 at 12:17 PM, Alex Boisvert <al...@gmail.com> wrote:
> Hi Sean,
>
> ScalaTest currently runs test in the same VM as Buildr (through RJB if
> you're using MRI) so it's too late to pass the java.library.path through
> test.using.
>
> (Incidentaly, we should probably add support for the :fork option for
> ScalaTest).
>
> To get the library path set up correctly with RJB, either set the JAVA_OPTS
> environment variable before invoking Buildr,
>
> export JAVA_OPTS=-Djava.library.path=...
>
> or put the following at the top of your Buildfile,
>
> ENV["JAVA_OPTS"] = "-Djava.library.path=..."
>
> alex
>
> On Sun, Oct 17, 2010 at 8:07 AM, Sean Rhea <se...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm working on moving a Scala library for accessing sqlite3 to Buildr.
>>  As this library wraps the C interface to sqlite3, it contains some
>> JNI code.  On MacOS, the only way to pick up a JNI library is to add
>> it to the current directory, or to pass a java.library.path property
>> to the JVM.  I took a look at lib/buildr/scala/shell.rb, and it
>> doesn't look like there's any way to pass properties to the JVM when
>> involving the Scala shell.  (At least, not in version 1.4.3.)
>>
>> I also tried to use ScalaTest with my project, and I added this line
>> to the buildfile:
>>
>>  test.using :properties => { "java.library.path" => "target/native" }
>>
>> But that doesn't seem to pick up the library, either.
>>
>> If I run this from the command line, it works fine:
>>
>>  scala -classpath target/classes -Djava.library.path=target/native Test
>>
>> What am I missing?
>>
>> Thanks in advance,
>> Sean
>> --
>> "I refuse to accept the idea that the ‘isness’ of man’s present nature
>> makes him morally incapable of reaching up for the eternal ‘oughtness’
>> that forever confronts him." --MLK
>>
>



-- 
"I refuse to accept the idea that the ‘isness’ of man’s present nature
makes him morally incapable of reaching up for the eternal ‘oughtness’
that forever confronts him." --MLK

Re: Passing -Djava.library.path=target/native to all tasks

Posted by Alex Boisvert <al...@gmail.com>.
Hi Sean,

ScalaTest currently runs test in the same VM as Buildr (through RJB if
you're using MRI) so it's too late to pass the java.library.path through
test.using.

(Incidentaly, we should probably add support for the :fork option for
ScalaTest).

To get the library path set up correctly with RJB, either set the JAVA_OPTS
environment variable before invoking Buildr,

export JAVA_OPTS=-Djava.library.path=...

or put the following at the top of your Buildfile,

ENV["JAVA_OPTS"] = "-Djava.library.path=..."

alex

On Sun, Oct 17, 2010 at 8:07 AM, Sean Rhea <se...@gmail.com> wrote:

> Hi,
>
> I'm working on moving a Scala library for accessing sqlite3 to Buildr.
>  As this library wraps the C interface to sqlite3, it contains some
> JNI code.  On MacOS, the only way to pick up a JNI library is to add
> it to the current directory, or to pass a java.library.path property
> to the JVM.  I took a look at lib/buildr/scala/shell.rb, and it
> doesn't look like there's any way to pass properties to the JVM when
> involving the Scala shell.  (At least, not in version 1.4.3.)
>
> I also tried to use ScalaTest with my project, and I added this line
> to the buildfile:
>
>  test.using :properties => { "java.library.path" => "target/native" }
>
> But that doesn't seem to pick up the library, either.
>
> If I run this from the command line, it works fine:
>
>  scala -classpath target/classes -Djava.library.path=target/native Test
>
> What am I missing?
>
> Thanks in advance,
> Sean
> --
> "I refuse to accept the idea that the ‘isness’ of man’s present nature
> makes him morally incapable of reaching up for the eternal ‘oughtness’
> that forever confronts him." --MLK
>