如何修复“缺少代码库,权限和应用程序名称清单属性”在我的JNLP应用程序中? [英] How do I fix "missing Codebase, Permissions, and Application-Name manifest attribute" in my JNLP app?

查看:248
本文介绍了如何修复“缺少代码库,权限和应用程序名称清单属性”在我的JNLP应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着最近的Java更新,许多人在使用缺少 Codebase 权限的Java Web Start应用程序时遇到问题,和应用程序名称清单属性。虽然有资源可以帮助你实现这一目标,但我找不到任何全面这个问题的答案,我觉得Q-and-A会很好。所以,问题是:

With the recent Java updates, many people are having trouble with their Java Web Start apps lacking Codebase, Permissions, and Application-name manifest attributes. Although there are resources out there to help you accomplish this, I couldn't find any comprehensive answers to this question, I so I felt a Q-and-A would be good. So, here's the question:

我的Java Web Start应用程序在控制台中显示以下警告:

Missing Permissions manifest attribute for: http://www.codebase.com/myApp/dist/myApp.jar
Missing Codebase manifest attribute for: http://www.codebase.com/myApp/dist/myApp.jar
Missing Application-Name manifest attribute for: http://www.codebase.com/myApp/dist/myApp.jar

如何解决此问题?

推荐答案

(1)首先,您需要创建一个包含要添加的所有属性的文本文件。我的文本文件如下所示:

(1) First, you need to create a text file with all of the attributes you want to add. My text file looks like this:

Permissions: all-permissions
Codebase: http://www.codebase.com/myApp/dist
Application-Name: My Application

我将其命名为 addToManifest.txt 。显然,您需要更改参数以满足您的应用需求。

I named it addToManifest.txt. Obviously, you'll need to change the parameters to match your application's needs.

(2)接下来,您需要将其添加到主.jar和所有库。执行此操作的命令是:

(2) Next, you need to add this to the main .jar and all of the libraries as well. The command to do this is:

jar ufm dist\myApp.jar addToManifest.txt

当然 dist\myApp.jar 将需要指向您的主要内容.jar是。您还需要为所有库执行此操作。

of course dist\myApp.jar will need to point to whatever your main .jar is. You'll also need to do this for all of the libraries as well.

jar ufm dist\lib\jcommon-1.0.16.jar addToManifest.txt
jar ufm dist\lib\jfreechart-1.0.13.jar addToManifest.txt
jar ufm dist\lib\joda-time-2.2.jar addToManifest.txt
...

(注意:在Windows上,我写了 .bat 此文件。)

(Note: on Windows, I wrote a .bat file for this.)

执行此操作后,属性应写入的.jar 秒。您可以在zip管理器(如7-Zip)中打开.jars,解压缩 MANIFEST.MF 文件,在文本编辑器中打开它,您应该看到属性列出。

Once you do this, the attributes should be written to the .jars. You can open the .jars in a zip manager (like 7-Zip), extract the MANIFEST.MF file, open it in a text editor, and you should see the attributes listed.

(3)添加属性后,您需要重新设置应用。执行此操作的命令是:

(3) After adding the attributes, you need to resign your app. The command to do that is:

jarsigner dist\myApp.jar -keystore "C:\myApp\KEYSTORE.ks" alias -storepass password

您还需要为所有库执行此操作:

You'll also need to do this for all of your libraries as well:

jarsigner dist\lib\jcommon-1.0.16.jar -keystore "C:\myApp\KEYSTORE.ks" alias -storepass password
jarsigner dist\lib\jfreechart-1.0.13.jar -keystore "C:\myApp\KEYSTORE.ks" alias -storepass password
jarsigner dist\lib\joda-time-2.2.jar -keystore "C:\myApp\KEYSTORE.ks" alias -storepass password

之后,你的属性应该被添加,你的 .jar 应该签名!

After that, your attributes should be added and your .jars should be signed!

注意:除非要更改库结构,否则只需要对库进行一次签名/部署。也就是说,如果您正在更新您的应用程序,但图书馆已经更改了清单,正确签名并进行了部署,则除非您在应用程序中添加/删除库,否则无需重新签名/部署库。

NOTE: You only need to sign/deploy your libraries once unless you are changing the library structure. i.e., if you are updating your app but the libraries have already had their manifests altered, signed properly, and deployed, you won't need to resign/deploy the libraries unless you are adding/removing libraries from your app.

注意#2:当前版本的Netbeans将添加代码库权限只显示主要.jar 的属性,但不显示属于您的库的属性。如果您使用Netbeans,当您尝试添加重复的清单属性时,您将收到来自 jar 实用程序的警告。队列中有一个错误报告可以修复 https://netbeans.org/bugzilla/show_bug.cgi? id = 234231

NOTE #2: The current version of Netbeans will add Codebase and Permissions manifest attributes to your primary .jar only, but not to your libraries. If you use Netbeans, you will receive a warning from the jar utility when you try to add a duplicate manifest attribute. There is a bug report in the queue to have this fixed https://netbeans.org/bugzilla/show_bug.cgi?id=234231.

编辑:最新版本的Netbeans(8.0)现在添加了全部三个( Codebase <清单上的/ code>,权限应用程序名称)。

The latest version of Netbeans (8.0) now adds all three (Codebase, Permissions, and Application-Name) to the manifest for you.

这篇关于如何修复“缺少代码库,权限和应用程序名称清单属性”在我的JNLP应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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