everyone!
I have a signed applet (named result in html) with a simple function as below:
我有一个签名的applet(命名为html的结果),其功能如下:
public void killApplet()
{
AccessController.doPrivileged(new PrivilegedAction<Object>(){
//@Override
public Object run() {
// kill the JVM
System.exit(0); // or any other line here
String str = "any string";
return null;
}
});
}
The Java script code is like:
Java脚本代码如下:
function exec_java() {
document.result.killApplet();
}
When I click the button to execute the java function:
当我单击按钮执行java函数时:
<button type="button" id="buttontest" onclick="exec_java()">test</button>
It shows up an exception as below:
它显示如下异常:
java.security.AccessControlException: access denied
(java.io.FilePermission C:\Program Files\Java\jdk1.6.0_18\bin read)
I am using Windows XP with IE version as below:
我正在使用Windows XP与IE版本如下:
IE 7
Vision: 7.0.5730.13
Any expert and give me a clue how to make this exception gone? Additionally, the weird thing here is I can call a simple function without problem like below:
任何专家,并告诉我如何使这个例外消失?另外,这里奇怪的是我可以调用一个没有问题的简单函数,如下所示:
public int getNumberOfLines(){
return number_of_lines;
}
Any help would be appreciated! PS: Can't post any images cos apparently I am 'new'! Does anyone have a working sample using?
任何帮助,将不胜感激! PS:显然不能张贴任何图像我是'新'!有没有人使用过工作样本?
AccessController.doPrivileged(new PrivilegedAction<Object>()
Thanks!
Wu Bi
1 个解决方案
#1
0
// kill the JVM
System.exit(0);
An applet is a guest in a web page that might host other applets. Calling System.exit(n)
is like the guest burning down the guest-house. Don't do that! As such, even a trusted applet is not allowed to invoke the method.
applet是可能托管其他applet的网页中的guest虚拟机。调用System.exit(n)就像烧毁宾馆的客人一样。不要那样做!因此,即使是受信任的applet也不允许调用该方法。
A better way to end an applet is to call:
结束applet的更好方法是调用:
showDocument(thanksForUsingOurAppletURL);
#1
0
// kill the JVM
System.exit(0);
An applet is a guest in a web page that might host other applets. Calling System.exit(n)
is like the guest burning down the guest-house. Don't do that! As such, even a trusted applet is not allowed to invoke the method.
applet是可能托管其他applet的网页中的guest虚拟机。调用System.exit(n)就像烧毁宾馆的客人一样。不要那样做!因此,即使是受信任的applet也不允许调用该方法。
A better way to end an applet is to call:
结束applet的更好方法是调用:
showDocument(thanksForUsingOurAppletURL);