Accepted answer

had forgotten this issue... i was actually asking with eclipse, sorry for not stating that originally. and the answer seems to be too simple (at least with 3.5; probably with older versions also):

java run configuration's arguments : vm arguments:


must not forget the quotation marks, otherwise there are problems with spaces in path.


on windows, i have found that the important thing is to start eclipse from the command line rather than from the start menu or a shortcut, provided that the native dll is in a directory in your path. apparently, this ensures that the proper directory is on the path.


the native library file name has to correspond to the jar file name. this is very very important. please make sure that jar name and dll name are same. also,please see the post from fabian steeg my download for jawin was containing different names for dll and jar. it was jawin.jar and jawind.dll, note extra 'd' in dll file name. i simply renamed it to jawin.dll and set it as a native library in eclipse as mentioned in post ""


for some reason i couldn't get multiple folders to work (well it did for a while but as soon as i needed more dlls and added more folders, none with white spaces in the path). i then copied all needed dlls to one folder and had that as my java.library.path and it worked. i don't have an explanation - if anyone does, it would be great.


many of the existing answers assume you want to set this for a particular project, but i needed to set it for eclipse itself in order to support integrated authentication for the sql server jdbc driver.

to do this, i followed these instructions for launching eclipse from the java commandline instead of its normal launcher. then i just modified that script to add my -djava.library.path argument to the java commandline.


window->preferences->java->installed jres. then choose your current jre(jdk) and click edit. fill default vm arguments: -djava.library.path=/usr/local/xuggler/lib. done!


the solution offered by rob elsner in one of the comments above works perfectly (osx 10.9, eclipse kepler). one has to append their additional paths to that separated by ":".

you could also use ${system_property:java.library.path} – rob elsner nov 22 '10 at 23:01


can you get round this by calling system.load() programmatically to load your native library? this method (unlike system.loadlibrary()) allows you to specify an absolute path.


in unix systems, you can append to the ld_library_path environment variable. on windows, the jvm automatically sets the system property, java.library.path, to path; so if the dll is on your path, then you're set.

score:2 states that there is no substitution mechanics implemented in eclipse's launcher, at least no up to release juno.

thus it is (almost) impossible to append or prepend another library folder to java.library.path when launching eclipse without prior knowledge of the default setting.

i wrote almost, cause it should be possible to let eclipse startup, dump the content of java.library.path and stop eclipse in one command. the dump would the be parsed and then taken as the input for launching eclipse, i.e.

# get default value of java.library.path (somehow)
default_lib_path=$( start_dump_stop_eclipse_somehow )  

# now launch eclipse
eclipse --launcher.appendvmargs \
         -vmargs \


  1. on windows: add the path to the library to the path environment variable.
  2. on linux: add the path to the library to the ld_library_path environment variable.
  3. on mac: add the path to the library to the dyld_library_path environment variable.

java.library.path is initilized with the values of the variables above on its corresponding platform.

this should work on any ide.

you can test if the value is what you expect by calling java -xshowsettings:properties


in windows, like this:


%path% is your old -djava.library.path


swt puts the necessary native dlls into a jar. search for "org.eclipse.swt.win32.win32.x86_3.4.1.v3449c.jar" for an example.

the dlls must be in the root of the jar, the jar must be signed and the dll must appear with checksum in the meta-inf/ for the vm to pick them up.


if you want to add a native library without interfering with java.library.path at development time in eclipse (to avoid including absolute paths and having to add parameters to your launch configuration), you can supply the path to the native libraries location for each jar in the java build path dialog under native library location. note that the native library file name has to correspond to the jar file name. see also this detailed description.

Related Query

More Query from same tag