Flying Swissman
Flying Swissman

Reputation: 803

Referenced Library in Java Project only finds native dll when I specify where they are in IDE

I have a library in eclipse that uses native libraries (two dll). The dlls are in the same folder as the jar. When I run the application there is an error:

java.lang.UnsatisfiedLinkError: no xx in java.library.path

When I link the library by double click on native library location, then running it works. However, I don't want to have to do this, I want it to work with out having to configure it via the IDE. I want the library to be plug and play.

Q1: Where is the convetional location to put .dll referenced by a .jar library.

Q2: How can I make sure when someone references my library in eclipse it works without further IDE configuration?

eclipse view

Upvotes: 0

Views: 563

Answers (1)

Yogesh Kulkarni
Yogesh Kulkarni

Reputation: 887

Error explains it clearly that your native libraries are not in the default location of java.library.path

You just have to set property java.library.path to the folder where all native libraries are stored. You can do this by giving argument in the command line -Djava.library.path=C:/nativeLibs/

OR

Copy your libraries to default location of java.library.path

Refer Default Java library path? for default location of java.library.path

Upvotes: 1

Related Questions