"System.loadLibrary" From JApplet

When I try to run: "System.loadLibrary("myDll")" from a JApplet I receive this error message:

java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.SNJApi) at java.security.AccessControlContext.checkPermission(Unknown Source)

I use Java 1.6.0_01

I run my applet with the following html code:

<html>

<head>

<title>ApiApplet</title>

</head>

<body>

<h1>Test page for ApiApplet Class</h1><hr>

<applet

code="SNJApi.ApiApplet.class"

archive="ApiApplet.jar"

width=900 height=450

></applet>

<hr>

</body>

</html>

I have signed the applet like is show in sun tutorial.. but my applet doesn't work.. How can I do..?

Thanks..

[861 byte] By [Fada] at [2007-11-27 4:18:38]
# 1

I was having the same problem with Java 1.5.0_11 and java.security.AccessController fixed things for me. Instead of System.loadLibrary(libName), try PrivilegedFoo.loadLibrary(libName), where PrivilegedFoo is something like:

class PrivilegedFoo implements PrivilegedExceptionAction{

private String libName;

public PrivilegedFoo(String libName) {

this.libName = libName;

}

public Object run() throws Exception {

// insert appropriate error handling

System.loadLibrary(libName);

}

public static void loadLibrary(String libName) throws Exception {

AccessController.doPrivileged(new PrivilegedFoo(libName);

}

}

ehsiunga at 2007-7-12 9:25:27 > top of Java-index,Security,Signed Applets...