1

Dummy question but I spent half an hour looking for an answer

If I try to set it on runtime

System.setProperty("java.library.path", "C:\\Users\\elect\\Documents\\SixenseSDK_062612\\SixenseSDK_062612\\bin\\x64\\release_dll");

or

System.setProperty("java.library.path", "C:\\Users\\elect\\Documents\\SixenseSDK_062612\\SixenseSDK_062612\\bin\\x64\\release_dll\\");

it doesnt see the lib

if I put it in the VM option it works, but I want to append, neither %% or $ work

Ps: I am on win

elect
  • 6,765
  • 10
  • 53
  • 119
  • My tip to you is to always distribute JNI DLL files in the same directory as the JAR file and you'll never have to worry about library paths again. Or if you know exactly where they're going to be installed in the target environment, use their full pathnames in the loadLibrary() call. – user207421 Aug 21 '14 at 07:09
  • @EJP, thanks, I am gonna try it once at home – elect Aug 21 '14 at 08:10

2 Answers2

0

Make use of

System.getProperty("java.library.path")

to append it using

System.setProperty("java.library.path")
Seyf
  • 889
  • 8
  • 16
0

What kind of library do you want to add? If it's some java libraries (i.e. a jar) you want to change classpath instead.

cf. How to setup classpath in Netbeans?

You probably don't need to change library path unless you are using some custom native library (with a .dll in windows)

cf. Including Native Library in Netbeans

Community
  • 1
  • 1
scherzoteller
  • 127
  • 1
  • 3
  • 7
  • I want to append DLLs and the answer you pointed me just overwrite it – elect Aug 21 '14 at 08:06
  • The getProp/setProp method should work. However It doesn't sound like a good idea to code some path in java classes. If you really want to do that define at least your own property to update the lib path. I also read that something like that can be done -Djava.library.path=${system_property:java.library.path} However I don't manage to make it work. – scherzoteller Aug 22 '14 at 12:11
  • Dont worry ^^. Anyway, I definitely agree with you, but as far as there is no other alternative, we are stuck on this.. – elect Aug 22 '14 at 12:27