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

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

问题描述

随着最近的 Java 更新,许多人在他们的 Java Web Start 应用程序中遇到了缺少 CodebasePermissionsApplication-name 的问题显化属性.尽管有一些资源可以帮助您完成此任务,但我找不到该问题的任何全面答案,因此我觉得问答会很好.那么问题来了:

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.)

执行此操作后,应将属性写入 .jars.您可以在 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 会将 CodebasePermissions 清单属性添加到您的仅主要 .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) 现在将所有三个(CodebasePermissionsApplication-Name)添加到为你清单.

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天全站免登陆