I have an applet the loadslibrary
using a System
call through a static method called loadLibrary
.
System.loadLibrary("ReadRegistry");
This works fine as long as I call loadLibrary
from within the applet. However, if from javascript开发者_JS百科 I access another method, called handleLoad()
, which calls the loadLibrary
method, I get a java security error when I try to call the System.loadLibrary
statement.
Why would that be?
Once a call is invoked by JS, a JRE becomes less trusting of it.
To solve that, wrap the problem code in a PrivilegedAction
and call it using one of the AccessController.doPriviliged()
variants.
精彩评论