public static void registerNativePaths(String... paths) { if (paths == null || paths.length == 0) return; String propertyValue = System.getProperty(ENV_LIB_PATH); StringBuilder builder = new StringBuilder(); for (String path : paths) { if (!StringUtils.isNullOrEmpty(propertyValue) && (!propertyValue.contains(path) || propertyValue.contains(path + File.separator))) { builder.append(path).append(File.pathSeparator); } } if (!StringUtils.isNullOrEmpty(propertyValue)) { propertyValue = builder.toString() + propertyValue; } else { propertyValue = builder.toString(); } System.setProperty(ENV_LIB_PATH, propertyValue); try { PrivilegedAccessor.setStaticValue(ClassLoader.class, "sys_paths", null); } catch (Exception e) { throw new RuntimeException(e); } }