Elliott
Elliott

Reputation: 5609

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

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 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?

Upvotes: 2

Views: 248

Answers (1)

Andrew Thompson
Andrew Thompson

Reputation: 168845

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.

Upvotes: 2

Related Questions