Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lildata/cb04ab4cdaee62afe1fe to your computer and use it in GitHub Desktop.
Save lildata/cb04ab4cdaee62afe1fe to your computer and use it in GitHub Desktop.
You usually can't change java.library.path at runtime since it seems to be evaluated at the start and then cached. But with this little trick it is being reevaluated.
System.setProperty("java.library.path", newpath)
val fieldSysPath = classOf[ClassLoader].getDeclaredField("sys_paths")
fieldSysPath.setAccessible(true)
fieldSysPath.set(null, null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment