开发者

java security error when loading dll from a Javascript call but not when directly called from applet

开发者 https://www.devze.com 2023-04-11 21:28 出处:网络
I have an applet the loadslibrary using a System call through a static method called loadLibrary. System.loadLibrary(\"ReadRegistry\");

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消