code: private static void resetJavaLibraryPath() {
          synchronized (Runtime.getRuntime()) {
              try {
                  Field field = ClassLoader.class.getDeclaredField("usr_paths");
                  field.setAccessible(true);
                  field.set(null, null);
  
                  field = ClassLoader.class.getDeclaredField("sys_paths");
                  field.setAccessible(true);
                  field.set(null, null);
              } catch (NoSuchFieldException e) {
                  throw new RuntimeException(e);
              } catch (IllegalAccessException e) {
                  throw new RuntimeException(e);
              }
          }
      }
docs: Delete the cache of "java.library.path". This will force the classloader to recheck the modified value the next time we load
  libraries.
  
  Attention HACK : This is specific to Sun JVM and may not function on other JVM or other version of JVM... Currently checked
  with JDK 1.5.x & 1.6.x