Discussion:
Finding Native JNI Library in Netbeans
orioncarrier
2008-04-18 04:54:47 UTC
Permalink
Hi all,

I've googled, and scanned the posts, and can't seem to solve my problem.

I can't seem to get a JNI shared object library (.so) to load when I run my
Java application in Netbeans. But when I run the application from the
command line, it works just fine.

When running the application at the command line, I use the following
arguments and everything works fine (I have the libary loaded in {Project
Folder}/lib):

java -Djava.library.path={Project Path}/lib -jar dist/ateui.jar

In Netbeans, I have tried setting "Arguments" on the Run tab of Project
Properties to each of:

-Djava.library.path={Project Path}/build/classes/lib
-Djava.library.path={Project Path}/dist/lib
-Djava.library.path={Project Path}/lib

...making sure I have a copy of the native library in all three locations in
each case, and regardless, I get the following stack trace:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no JniRpcLib in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at gpGuiRpcConnection.<clinit>(gpGuiRpcConnection.java:106)
at ateui.main(ateui.java:178)

If there is something I am missing, I would greatly appreciate knowing, as I
have one week left in this job. :)

Thanks warmly,
Orion Carrier
--
View this message in context: http://www.nabble.com/Finding-Native-JNI-Library-in-Netbeans-tp16760154p16760154.html
Sent from the Netbeans - Users mailing list archive at Nabble.com.
orioncarrier
2008-04-18 05:16:14 UTC
Permalink
I have also now tried System.load(<full_path_and_name_to_library>) with the
same result. Library not found.

Thanks,
Orion
Post by orioncarrier
Hi all,
I've googled, and scanned the posts, and can't seem to solve my problem.
I can't seem to get a JNI shared object library (.so) to load when I run
my Java application in Netbeans. But when I run the application from the
command line, it works just fine.
When running the application at the command line, I use the following
arguments and everything works fine (I have the libary loaded in {Project
java -Djava.library.path={Project Path}/lib -jar dist/ateui.jar
In Netbeans, I have tried setting "Arguments" on the Run tab of Project
-Djava.library.path={Project Path}/build/classes/lib
-Djava.library.path={Project Path}/dist/lib
-Djava.library.path={Project Path}/lib
...making sure I have a copy of the native library in all three locations
Exception in thread "main" java.lang.UnsatisfiedLinkError: no JniRpcLib in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at gpGuiRpcConnection.<clinit>(gpGuiRpcConnection.java:106)
at ateui.main(ateui.java:178)
If there is something I am missing, I would greatly appreciate knowing, as
I have one week left in this job. :)
Thanks warmly,
Orion Carrier
--
View this message in context: http://www.nabble.com/Finding-Native-JNI-Library-in-Netbeans-tp16760154p16760354.html
Sent from the Netbeans - Users mailing list archive at Nabble.com.
Johnny Kewl
2008-04-18 13:24:28 UTC
Permalink
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
Making the Java dream come true.
---------------------------------------------------------------------------

Hi OrionCarrier,

Its been a while and I forget the details, but I remember having similar
problems.

If I remember correctly it will work if you put the lib in the JRE/bin

and I think its because the paths are set as the JRE starts, so NB is
already running so too late, something like that.
which probably means it needs to be set as part of NB props, which is kinda
pointless, easier to just shift it to bin.

What I remember doing to make life a little better is using this function...
in the test code.
System.load("/the/path/to/your/lib/actual/name");
Then when tested swap out to System.LoadLibrary("SystemName");

Its not you, or NB... its a Java thing, I think.


----- Original Message -----
From: "orioncarrier" <***@gmail.com>
To: <***@netbeans.org>
Sent: Friday, April 18, 2008 6:54 AM
Subject: [nbusers] Finding Native JNI Library in Netbeans
Post by orioncarrier
Hi all,
I've googled, and scanned the posts, and can't seem to solve my problem.
I can't seem to get a JNI shared object library (.so) to load when I run my
Java application in Netbeans. But when I run the application from the
command line, it works just fine.
When running the application at the command line, I use the following
arguments and everything works fine (I have the libary loaded in {Project
java -Djava.library.path={Project Path}/lib -jar dist/ateui.jar
In Netbeans, I have tried setting "Arguments" on the Run tab of Project
-Djava.library.path={Project Path}/build/classes/lib
-Djava.library.path={Project Path}/dist/lib
-Djava.library.path={Project Path}/lib
...making sure I have a copy of the native library in all three locations in
Exception in thread "main" java.lang.UnsatisfiedLinkError: no JniRpcLib in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at gpGuiRpcConnection.<clinit>(gpGuiRpcConnection.java:106)
at ateui.main(ateui.java:178)
If there is something I am missing, I would greatly appreciate knowing, as I
have one week left in this job. :)
Thanks warmly,
Orion Carrier
--
http://www.nabble.com/Finding-Native-JNI-Library-in-Netbeans-tp16760154p16760154.html
Sent from the Netbeans - Users mailing list archive at Nabble.com.
Continue reading on narkive:
Loading...