Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / December 2006

Tip: Looking for answers? Try searching our database.

Multiple java.library.paths ?

Thread view: 
me2 - 09 Dec 2006 16:17 GMT
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 - 09 Dec 2006 17:05 GMT
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 - 09 Dec 2006 17:16 GMT
> 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.

/gordon

Signature

[ 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 - 09 Dec 2006 17:14 GMT
> 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

Signature

[ 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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.