NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

netbeans doesnt link to libraries known to ld (linux)

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
quantum.leaf



Joined: 25 Jul 2009
Posts: 5

PostPosted: Sat Jul 25, 2009 6:41 pm    Post subject: netbeans doesnt link to libraries known to ld (linux) Reply with quote

Hi All,

I'm trying to solve this problem for awhile without luck and am now turning to this forum for help.

I have an application that requires a native library.

I know i could set the run parameter -Djava.library.path to the point the library. But this doesnt work in some cases where the library calls another library.

Another solution would be to set the LD_LIBRARY_PATH environment variable before launching netbeans. But again I dont want to do this.

Instead I have added the path to the lib to /etc/ld.so.conf.d/file.conf
and run sudo ldconfig.

I can do:
sudo ldconfig -v | grep -i gluegen
and get:
libgluegen-rt.so -> libgluegen-rt.so

and if i run simple test program from the command line like this it works and the library is linked successfully.

But when i try to run it in netbeans i get:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path

so it seems netbeans launch classes don't have the same libraries available as java classes run from the command line.

Why is this?
What can be done about it?
etc
Back to top
quantum.leaf



Joined: 25 Jul 2009
Posts: 5

PostPosted: Sat Jul 25, 2009 6:48 pm    Post subject: Re: netbeans doesnt link to libraries known to ld (linux) Reply with quote

quantum.leaf wrote:
Hi All,

I'm trying to solve this problem for awhile without luck and am now turning to this forum for help.

I have an application that requires a native library.

I know i could set the run parameter -Djava.library.path to the point the library. But this doesnt work in some cases where the library calls another library.

Another solution would be to set the LD_LIBRARY_PATH environment variable before launching netbeans. But again I dont want to do this.

Instead I have added the path to the lib to /etc/ld.so.conf.d/file.conf
and run sudo ldconfig.

I can do:
sudo ldconfig -v | grep -i gluegen
and get:
libgluegen-rt.so -> libgluegen-rt.so

and if i run simple test program from the command line like this it works and the library is linked successfully.

But when i try to run it in netbeans i get:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path

so it seems netbeans launch classes don't have the same libraries available as java classes run from the command line.

Why is this?
What can be done about it?
etc
Back to top
quantum.leaf



Joined: 25 Jul 2009
Posts: 5

PostPosted: Sat Jul 25, 2009 7:02 pm    Post subject: Reply with quote

this always happens.

i spend days on a problem and when i give up and go to a forum for help i immediately find the answer... maybe its some kinda quantum synchronisity thing... Wink

anyway in case anyone else has this problem:

It wasn't working because i had a -Djava.library.path argument set that wasnt point to the right place and apparenly stops netbeans linking to places ld knows about.

once i removed that it works.

once you work it out using ldconfig is definitely the best way to link libraries into the system.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo