Java 7 中新的 JNLP Missing items 警告是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19451356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 17:17:59  来源:igfitidea点击:

What's with the new JNLP Missing items warnings in Java 7?

javasecurityjava-web-startjnlp

提问by Brian Knoblauch

My JNLP still works fine after our switch from Java 6 to Java 7, but it now throws a whole series of errors like this:

在我们从 Java 6 切换到 Java 7 后,我的 JNLP 仍然可以正常工作,但它现在引发了一系列错误,如下所示:

Missing Application-Name: manifest attribute for: http://blah.com/app.jar
Missing Permissions manifest attribute for: http://blah.com/app.jar
Missing Codebase manifest attribute for: http://blah.com/app.jar

It repeats several times for our main jar and a couple times for one of our library jars. However, it does not occur at all for the bulk of our library jars. JaNeLa lists some optimization opportunities (by changing some defaults), but none of those appear to be related, and no actual errors are found.

它对我们的主 jar 重复几次,对我们的一个库 jar 重复几次。但是,对于我们的大部分库 jar,它根本不会发生。JaNeLa 列出了一些优化机会(通过更改一些默认值),但这些似乎都不相关,也没有发现实际错误。

So far searching the web has left me empty handed on how to make the JNLP file format into something that Java 7 finds worthy. :-)

到目前为止,在网络上搜索使我对如何将 JNLP 文件格式变成 Java 7 认为有价值的东西一无所知。:-)

采纳答案by mth

See Missing Codebase manifest attribute for:xxx.jarfor an explanation for Permissions and Codebase. If you use ant, you can use the following to add the entries to the manifest:

有关权限和代码的说明,请参阅缺少代码库清单属性 for:xxx.jar。如果您使用 ant,则可以使用以下命令将条目添加到清单中:

<manifest file="${source}/META-INF/MANIFEST.MF" mode="update">
  <attribute name="Permissions" value="all-permissions"/>
  <attribute name="Codebase" value="${jnlp.codebase}"/>
  <attribute name="Application-Name" value="${app.name}"/>
</manifest>

Java 7 update 45 broke my Web Start SWT applicationmight also have some interesting information

Java 7 update 45 破解我的Web Start SWT 应用程序可能还有一些有趣的信息

回答by Thorn

This issue affects both JNLP and applets. The jar files are required to have a permission attribute in the manifest file. I believe the other errors are less critical. The latest JRE shows end users a warning message stating that starting January, 2014the latest JRE will refuse to runany applet or JNLP jar files with a missing Permissionsattribute.

此问题会影响 JNLP 和小程序。jar 文件需要在清单文件中具有权限属性。我相信其他错误不那么严重。最新的 JRE 向最终用户显示一条警告消息,指出从2014 年 1 月开始最新的 JRE 将拒绝运行任何缺少Permissions属性的小程序或 JNLP jar 文件。

See Java SE7 technotes on manifest.

请参阅manifest 上的 Java SE7 技术说明

The Java tutorial has a section on modifying the manifest filebut doing this with ant as suggested by @mth sounds simpler.

Java 教程有一节是关于修改清单文件的,但是按照@mth 的建议使用 ant 执行此操作听起来更简单。

回答by Laura Liparulo

I could make a self signed java web start application work with a workaround. Even though I can see warnings in the console, I get no more warnings. All I needed was:

我可以使用一种变通方法使自签名的 java web start 应用程序工作。即使我可以在控制台中看到警告,我也不会收到更多警告。我只需要:

  1. adding the "Permissions: all-permissions" attribute in the manifest.

  2. Adding the following tag in the jnlp file:

    <security>
       <all-permissions/>
    </security>
    
  3. signing my jars with my own keystore

  4. importing my own certificate in the Java Control Panel (on Windows).
  1. 在清单中添加“权限:所有权限”属性。

  2. 在 jnlp 文件中添加以下标签:

    <security>
       <all-permissions/>
    </security>
    
  3. 用我自己的密钥库签署我的罐子

  4. 在 Java 控制面板中导入我自己的证书(在 Windows 上)。

回答by Chris Ritchie

If you are using maven this can be done by simply adding something like this in your plugin configuration:

如果您使用的是 maven,只需在插件配置中添加类似的内容即可:

       <updateManifestEntries>
         <Permissions>all-permissions</Permissions>
         <Codebase>*</Codebase>
       </updateManifestEntries>

Taken from the plugin site here

取自这里的插件站点