Java 7 更新 45 破坏了我的 Web Start SWT 应用程序 [英] Java 7 update 45 broke my Web Start SWT application

查看:19
本文介绍了Java 7 更新 45 破坏了我的 Web Start SWT 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我维护了一个使用 WebStart 启动的 Eclipse RCP 应用程序.Java 7 u45 进行了一些安全更改,现在我的应用程序在启动时崩溃.

I maintain an Eclipse RCP application launched with WebStart. Java 7 u45 made some security changes, and now my application crashes on startup.

我已添加到清单中:

权限:所有权限

代码库:*

可信库:真实

这从控制面板中删除了所有警告消息.但是在尝试加载我的 IApplication 实现时,我仍然有一个类加载器问题,可能是我要加载的第一个类.这是更新 45 的新内容.

This removed all of the warning messages from the Control Panel. But I still have a classloader issue when trying to load my IApplication implemenentation, probably the first of my classes to load. This is new to update 45.

推荐答案

我遇到了同样的问题,并通过以下操作设法解决了这个问题:

I have experienced the same issue and managed to solve it by doing following:

在所有清单文件(对于 RCP 项目中的每个 JAR)中添加以下属性:

Application-Name: My App Name
Permissions: all-permissions
Codebase: *
Application-Library-Allowable-Codebase: *
Caller-Allowable-Codebase: *
Trusted-Library: true

解决方案的第二部分是通过添加 jnlp 前缀使 jnlp 属性安全.我在此处找到了解决方案.您需要为框架属性执行此操作(osgi、eclipse ..)以及您的属性而不是:

Second part of solution is to make jnlp properties secure by adding jnlp prefix. I have found solution here. You need to do this for framework properties (osgi, eclipse..) and for your properties E.g. instead of:

<property name="eclipse.product" value="com.amdosoft.oct.ui.product"/>
<property name="osgi.instance.area" value="@user.home/Application Data/myApp"/>
<property name="osgi.configuration.area" value="@user.home/Application Data/myApp"/>
<property name="my.App.property" value="someValue"/>

使用

<property name="jnlp.eclipse.product" value="com.amdosoft.oct.ui.product"/>
<property name="jnlp.osgi.instance.area" value="@user.home/Application Data/myApp"/>
<property name="jnlp.osgi.configuration.area" value="@user.home/Application Data/myApp"/>
<property name="jnlp.my.App.property" value="someValue"/>

这里

在 web start 启动器中,您需要将属性名称改回旧值(不带 jnlp 前缀).您可以通过将这部分源代码添加到 WebStartLauncher 类的 main 方法中来实现.

In web start launcher you need to change back property names to old values (without jnlp prefix). You can do that by adding this part of source into main method of WebStartLauncher class.

Properties properties = System.getProperties();
// copy properties to avoid ConcurrentModificationException
Properties copiedProperties = new Properties();
copiedProperties.putAll(properties);
Set<Object> keys = copiedProperties.keySet();
for (Object key : keys) {
    if (key instanceof String) {
        String keyString = (String) key;
        if (keyString.startsWith("jnlp.")) {
            // re set all properties starting with the jnlp-prefix 
            // and set them without the prefix
            String property = System.getProperty(keyString);
            String replacedKeyString = keyString.replaceFirst("jnlp.", "");

            System.setProperty(replacedKeyString, property);
        }
    }
}

将您的新启动器导出为可运行的 JAR,并将其放在 JNLP 文件所在的同一目录中.

Export you new launcher as runnable JAR and put it in the same directory where your JNLP file is located.

编辑 JNLP 文件,添加以下行:

<jar href="myAppLauncher.jar"/>

inside 标记并像这样编辑您的 application-desc 标记:

inside tag and edit your application-desc tag like this:

<application-desc main-class="org.eclipse.equinox.launcher.WebStartMain">
  </application-desc>

这篇关于Java 7 更新 45 破坏了我的 Web Start SWT 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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