System.setProperty("java.library.path", "pathToLibs");
doesnt work because it seems either "java.library.path" is read only or JVM just ignores the property.
I know it can be done by setting PATH(in windows), LD_LIBRARY_PATH(in POSIX) or just use the command java -Djava.library.path=your_path.
But is there a programming way of doing this?