Accepted answer

don't mess with the library path! eclipse builds it itself!

instead, go into the library settings for your projects and, for each jar/etc that requires a native library, expand it in the libraries tab. in the tree view there, each library has items for source/javadoc and native library locations.

specifically: select project, right click -> properties / java build path / libraries tab, select a .jar, expand it, select native library location, click edit, folder chooser dialog will appear)

messing with the library path on the command line should be your last ditch effort, because you might break something that is already properly set by eclipse.

native library location


the easiest way would to use the eclipse ide itself. go to the menu and set build path. make it point to the java jdk and jre file path in your directory. afterwards you can check the build path where compiled files are going to be set. in the bin folder by default though. the best thing would be to allow eclipse to handle itself the build path and only to edit it similar to the solution that is given above


sometime we dont get java build path by directly right click on project. then go to properties.... right click and go to properties

then click on java build pathproperties scrren

click on add external jar

click on tab add external jars and give path of your computer file where u have stored jars.


here is another fix:

my build system (gradle) added a required native library (dll) to the eclipse build path (right click on project -> properties -> java build path -> libraries). telling the build system not to add the native dll library to the eclipse classpath solved the problem.


you can add vm argument in your eclipse.

example :


where cots_lib is your external folder library.


remember to include the native library folder in path.


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


another solution would be to open the 'run configuration' and then in the 'environment' tab, set the couple {path,value}.

for instance to add a 'lib' directory located at the root of the project,

    path  <-  ${workspace_loc:name_of_the_project}\lib


click run
click debug ...
new java application
click arguments tab
in the 2nd box (vm arguments) add the -d entry

-xdebug -verbose:gc -xbootclasspath/p:jar/vbjorb.jar;jar/oracle9.jar;classes;jar/mq.jar;jar/xml4j.jar -classpath -dorbinitref=nameservice=iioploc://  



i think there is another reason for wanting to set java.library.path. subversion comes with many libraries and eclipse won't see these unless java.library.path can be appended. for example i'm on os-x, so the libraries are under \opt\subversion\lib. there are a lot of them and i'd like to keep them where they are (not copy them into a standard lib directory).

project settings won't fix this.


none of the solutions above worked for me (eclipse juno with jdk 1.7_015). java could only find the libraries when i moved them from project_folder/lib to project_folder.


just add the *.dll files to your c:/windows

you can get the java.library.path from the follow codes:and then add you dll files under any path of you get

import java.util.logging.logger;

public class test {

    static logger logger = logger.getlogger(test.class.getname());
    public static void main(string[] args) {"java.library.path"));


you can simply add -djava.library.path=yourpath to the eclipse.ini.


for a given application launch, you can do it as jim says.

if you want to set it for the entire workspace, you can also set it under

      installed jres

each jre has a "default vm arguments" (which i believe are completely ignored if any vm args are set for a run configuration.)

you could even set up different jre/jdks with different parameters and have some projects use one, other projects use another.


except the way described in the approved answer, there's another way if you have single native libs in your project.

  • in project properties->java build path->tab "source" there's a list of your source-folders
  • for each entry, there's "native library locations", which also supports paths within the workspace.
  • this will make eclipse add it to your java.library.path.


if you are adding it as a vm argument, make sure you prefix it with -d:


Related Query

More Query from same tag