无法在的IntelliJ一个applet工作 [英] Unable to make an applet work in IntelliJ

查看:1692
本文介绍了无法在的IntelliJ一个applet工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个完整的小白。
我刚学用java编程。
我也跟着教程,并创造了IntelliJ IDEA的以下小程序在我弟弟的电脑:

I am a complete noob. I am just learning to program using java. I followed a tutorial and created the following applet in IntelliJ Idea in my brother's computer:

import javax.swing.JApplet;
import java.awt.Graphics;
public class MyFirstApplet extends JApplet {
    public void paint(Graphics g) {
        g.drawString("To climb a ladder, start at the bottom rung.", 20, 90);
    }
}

当我尝试运行这一点,IDE显示:

When i try to run this , the IDE shows:

"Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\Abhirup_2\AppData\Local\Temp\AppletPage6525114136327939228.html" "read")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
    at java.security.AccessController.checkPermission(AccessController.java:559)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
    at java.io.File.isDirectory(File.java:838)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:82)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
    at sun.applet.AppletViewer.parse(AppletViewer.java:1103)
    at sun.applet.AppletViewer.parse(AppletViewer.java:1074)
    at sun.applet.Main.run(Main.java:156)
    at sun.applet.Main.main(Main.java:98)
    at sun.applet.AppletViewer.main(AppletViewer.java:1257)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Process finished with exit code 1

然而,它运行良好,在Eclipse我的朋友的电脑。
请帮助。

However it runs well in my friend's computer in eclipse. Please help.

更新:
有一个帐户,这是我弟弟的acoount。我使用的是和唯一的帐户,它应该有admiist​​rator权利,如果我没看错的。

UPDATE: There is a single account and that is my brother's acoount. I am using that and being the only account it should have admiistrator rights if I am not wrong.

推荐答案

您需要使用的授予运行作为本地小应用程序,并在政策文件字段设置它在你运行/调试配置权限的小程序策略文件

You need to use an applet policy file which grants permission to run as a local applet and set it in your Run/Debug configuration in the "Policy File" field.

它应该有最低如下:

grant {
    permission java.security.AllPermission;
}

或者你可以使用一个叫做通过的IntelliJ在应用程序bin目录中默认提供的 appletviewer.policy

这篇关于无法在的IntelliJ一个applet工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆