Java 错误:“您的安全设置已阻止本地应用程序运行" [英] Java Error: "Your security settings have blocked a local application from running"

查看:40
本文介绍了Java 错误:“您的安全设置已阻止本地应用程序运行"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的浏览器 (中看到的简单小程序(松散的类文件)internet - 拥有一个 applet 元素:

<p>Pluggable Look'n'Feel Changer 出现在支持 Java 的浏览器中.</p></小程序>

它似乎也加载成功.暗示:-

从本地文件系统加载的小程序现在受到比从 Internet 或本地服务器加载的小程序更严格的安全沙箱的约束.

安全设置说明

从 Java 7 更新 51 开始.

  • 非常高:最安全的设置 - 仅允许运行由受信任机构颁发的未过期证书标识的 Java 应用程序.
  • 高(推荐最低值):允许运行由受信任机构颁发的证书标识的 Java 应用程序.
  • - 所有 Java 应用程序在出现安全提示后都将被允许运行.

I'm trying to run this simple HelloWorld code written in Java from my browser (Chrome):

public class HelloWorld extends JApplet {
public void init() {
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                JLabel lbl = new JLabel("Hello World");
                add(lbl);
            }
        });
    }
    catch (Exception e) {
        System.err.println("createGUI didn't complete successfully");
    }
}

I compiled it with NetBeans, and then I created a WebApplication project. The HTML code that runs the applet is:

<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <p><applet code="HelloWorld" archive="applet_HelloWorld.jar"  width="590" height="530"></applet></p>
    </body>
</html>

If run the applet from NetBeans it works. But when I run the HTML code by double clicking it, the following message pops up from the browser:

Your security settings have blocked a local application from running.

I tried with Internet Explorer and Firefox but nothing.

This message started to appear after the last update of Java. Where is the problem?

解决方案

After reading Java 7 Update 21 Security Improvements in Detail mention..

With the introduced changes it is most likely that no end-user is able to run your application when they are either self-signed or unsigned.

..I was wondering how this would go for loose class files - the 'simplest' applets of all.

Local file system


Your security settings have blocked a local application from running

That is the dialog seen for an applet consisting of loose class files being loaded off the local file system when the JRE is set to the default 'High' security setting.


Note that a slight quirk of the JRE only produced that on point 3 of.

  1. Load the applet page to see a broken applet symbol that leads to an empty console.
    Open the Java settings and set the level to Medium.
    Close browser & Java settings.
  2. Load the applet page to see the applet.
    Open the Java settings and set the level to High.
    Close browser & Java settings.
  3. Load the applet page to see a broken applet symbol & the above dialog.

Internet

If you load the simple applet (loose class file) seen at this resizable applet demo off the internet - which boasts an applet element of:

<applet
    code="PlafChanger.class"
    codebase="."
    alt="Pluggable Look'n'Feel Changer appears here if Java is enabled"
    width='100%'
    height='250'>
<p>Pluggable Look'n'Feel Changer appears here in a Java capable browser.</p>
</applet>

It also seems to load successfully. Implying that:-

Applets loaded from the local file system are now subject to a stricter security sandbox than those loaded from the internet or a local server.

Security settings descriptions

As of Java 7 update 51.

  • Very High: Most secure setting - Only Java applications identified by a non-expired certificate from a trusted authority will be allowed to run.
  • High (minimum recommended): Java applications identified by a certificate from a trusted authority will be allowed to run.
  • Medium - All Java applications will be allowed to run after presenting a security prompt.

这篇关于Java 错误:“您的安全设置已阻止本地应用程序运行"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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