Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple java.library.paths ?

1,543 views
Skip to first unread message

me2

unread,
Dec 9, 2006, 11:17:23 AM12/9/06
to
I'm using eclipse on Linux. I'm using a 3rd party Java class in my
application.

My application runs fine until I invoke code that uses the 3rd party
application. When I do that, I get the following:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no xyz in
java.library.path

OK, so I did some googling and I added the path to xzy.so to
Run...->Arguments-> VM aguments -Djava.library.path=/home/.../lib

However, if I run with that added, I get the following as soon as my
application runs:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no
swt-pi-gtk-3235 in java.library.path

So it appears that I need to have 2 paths in my path specification.

a) how does one specify more than one path ? (I assume that one would use
a semicolon between paths ?)

b) what path do I use for this file ? I found libswt-pi-gtk-3235.so in
/.../eclipse/configuration/org.eclipse.osgi/bundles/41/1/.cp

I changed my VM argument to be
-Djava.library.path=/.../xyz/lib;/.../eclipse/configuration/org.eclipse.osgi/bundles/41/1/.cp

but I still got the same error. What am I doing wrong ?

BTW, I have the eclipse 3.1 installation folder in my home directory (ie ~).

I also tried /.../eclipse/plugins because it has
the org.eclipse.swt.gtk.linux.x86_3.2.1.v3235.jar file in it. That didn't
work either.

FWIW, I swear this app worked without the second path in eclipse 3.1. I am
now running 3.2.1

Thanks

me2

unread,
Dec 9, 2006, 12:05:11 PM12/9/06
to
I got it to work with

-Djava.library.path=/home/.../lib:/home/.../Desktop/eclipse/configuration/org.eclipse.osgi/bundles/41/1/.cp

It needed a colon, not a semicolon.

I still don't think its right having to specify the second path like that.
Should probably be a system variable or not needed at all.

Gordon Beaton

unread,
Dec 9, 2006, 12:14:13 PM12/9/06
to
On Sat, 09 Dec 2006 16:17:23 GMT, me2 wrote:
> a) how does one specify more than one path ? (I assume that one
> would use a semicolon between paths ?)

On Linux, java.library.path takes a colon separated list of
directories (not semicolon).

However, depending on the relationship between the two libraries, it
may be necessary to set environment variable LD_LIBRARY_PATH instead.
It too is a colon separated list of directories.

Also, if these libraries were not written specifically for JNI, then
you can't use them anyway in your application until you write a set of
JNI wrappers.

/gordon

--
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e

Gordon Beaton

unread,
Dec 9, 2006, 12:16:31 PM12/9/06
to
On Sat, 09 Dec 2006 17:05:11 GMT, me2 wrote:
> I still don't think its right having to specify the second path like
> that. Should probably be a system variable or not needed at all.

Why should two be any different than one?

Anyway as I mentioned in my previous response, you can set
LD_LIBRARY_PATH and forget about java.library.path altogether. And if
you don't like LD_LIBRARY_PATH, you can add the directories to
/etc/ld.so.conf instead.

0 new messages