Applet不会运行 - AccessControlException

时间:2015-01-05 01:15:39

标签: java applet

我是Java Applet编程的新手。我有这段代码:

import java.applet.*;
import java.awt.*;

public class HelloWorldApplet extends Applet
{
   public void paint (Graphics g)
   {

  g.drawString ("Hello World", 25, 50);

   }
}

但是我得到了一些我不太懂的错误。

Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission /private/var/folders/dm/297zvxwd3vs10nzgwgylhztw0000gn/T/AppletPage2031925998178007660.html read)

at java.security.AccessControlContext.checkPermission(AccessControlContext.java:376)
at java.security.AccessController.checkPermission(AccessController.java:549)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.isDirectory(File.java:752)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:65)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at sun.applet.AppletViewer.parse(AppletViewer.java:1085)
at sun.applet.AppletViewer.parse(AppletViewer.java:1056)
at sun.applet.Main.run(Main.java:138)
at sun.applet.Main.main(Main.java:80)
at sun.applet.AppletViewer.main(AppletViewer.java:1239)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

我该怎么办?

0 个答案:

没有答案