< prev index next >

src/java.base/share/classes/java/lang/System.java

Print this page
rev 55657 : 8227587: Add internal privileged System.loadLibrary
Reviewed-by: rriggs

*** 2272,2279 **** --- 2272,2296 ---- } public void setCause(Throwable t, Throwable cause) { t.setCause(cause); } + + @CallerSensitive + public void loadLibrary(String library) { + Class<?> klass = Reflection.getCallerClass(); + assert(library.indexOf(File.separatorChar) < 0, "library name must not contain directory separators"); + if (System.getSecurityManager() == null) { + ClassLoader.loadLibrary(klass, library, false); + } else { + AccessController.doPrivileged( + new java.security.PrivilegedAction<>() { + public Void run() { + ClassLoader.loadLibrary(klass, library, false); + return null; + } + }); + } + } }); } }
< prev index next >