svoid addToNativeLibraryPath(File dir) { if (dir == null) ret; S libraryPath = System.getProperty("java.library.path"); if (contains(splitAt(libraryPath, File.pathSeparator), f2s(dir))) ret; libraryPath += File.pathSeparator + f2s(dir); print("New java.library.path: " + libraryPath); System.setProperty("java.library.path", libraryPath); // hack for newer JDKs // see https://stackoverflow.com/questions/15409223/adding-new-paths-for-native-libraries-at-runtime-in-java // set sys_paths to null so that java.library.path will be reevalueted next time it is needed setOpt(ClassLoader.class, sys_paths := null); }