Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

giving 'java.library.path' in netbeans for .dll/.so files

How do i give the path for the .dll or .so file in netbeans to load the library using

System.loadLibrary("Foo")

I read this on netbeans page but couldn't help me. as it gives the unsatisfied link error.

These are the two things i tried :

In the following snapshot i created a lib folder inside the netbeans project and placed the dll files inside it.

enter image description here

In the second snapshot i created a lib folder inside the modules folder and placed all the dll files inside lib folder as stated in the link.

enter image description here

But both of them give me unsatisfied link error exception. How do i set java.library.path in netbeans so that i can directly test the application from netbeans, without having to go and write on the terminal ?

like image 705
saplingPro Avatar asked May 23 '12 06:05

saplingPro


People also ask

Where is Libraries folder in NetBeans?

Select Tools > Libraries to open up the Library Manager. Click the button Add JAR/Folder and browse to the lib folder within the ImageGear for Java installation directory. Select all *. jar files in the lib folder.

What is Djava library path?

java. library. path is a System property, which is used by Java programming language, mostly JVM, to search native libraries, required by a project.


1 Answers

I'm using Mac OS X Yosemite and Netbeans 8.02, I got the same error and the simple solution I have found is like above, this is useful when you need to include native library in the project. So do the next for Netbeans:

1.- Right click on the Project
2.- Properties
3.- Click on RUN
4.- VM Options: java -Djava.library.path="your_path"
5.- for example in my case: java -Djava.library.path=</Users/Lexynux/NetBeansProjects/NAO/libs>
6.- Ok

I hope it could be useful for someone. The link where I found the solution is here: java.library.path – What is it and how to use

like image 160
alexventuraio Avatar answered Oct 22 '22 06:10

alexventuraio