哦这个问题Trusted-Library AttributeFor applications and applets that are designed to allow unsigned components, the Trusted-Library attribute should be used. No warning dialog will be displayed and an application or applet may load jar files containing untrusted classes or resources. This attribute prevents signed components in an application or applet from being re-purposed with unsigned components. You can specify Trusted-Library: true in the manifest file. For example: Manifest-Version: 1.0 Trusted-Library: true Created-By: 1.6.0-internal (Sun Microsystems Inc.)All classes and resources in a jar file containing this manifest attribute must be signed and trusted.看它的介绍的话还是因为应用中涉及到了unsigned components,所以才需要这个属性
没关系 只是觉得奇怪那也有可能是Trusted-Only和Trusted-Library两者必用其一,都不用可能会导致问题Trusted-Only AttributeFor applications and applets that do not require unsigned components, the Trusted-Only attribute should be used. No warning dialog will be displayed and an application or applet that loads a jar file containing this attribute will not load any untrusted classes or resources. This attribute prevents a signed application or applet from being re-purposed with unsigned components. You can specify Trusted-Only: true in the manifest file. For example: Manifest-Version: 1.0 Trusted-Only: true Created-By: 1.6.0-internal (Sun Microsystems Inc.)All classes and resources in the application or applet must be signed and trusted.
以前也是这样用的,就没有这个警告提示,当时用的三方包不多,现在随着功能的扩展,又加了一些,就出现了这个。
打包的方式fat jar其实是将原有的jar包拆分,然后统一打包到你需要的jar包中,这样jar包中只有class文件和包,而没有jar文件,所以签名应该是对整个jar包生效的,不存在个别jar未签名的情况(我也有尝试使用eclipse的runnable jar打包方式,将所有jar签名之后打包,但是还是不行)。
其实oracle官方也有文章,只是他大部分介绍为什么会产生这种情况,在客户端设置避免,而并未阐述如何在打包的时候规避这个问题,链接:http://docs.oracle.com/javase/6/docs/technotes/guides/jweb/mixed_code.html
公布答案
才用半自动打包方式,手写MANIFEST.MF文件
Manifest-Version: 1.0
Trusted-Library: true
Created-By: 1.6.0-internal (Sun Microsystems Inc.)重点是:Trusted-Library: true可能我里面确实有部分组件自己签名了或者是代码保护了导致了这种问题。具体的不知道。
散分!
Trusted-Library: true
Created-By: 1.6.0-internal (Sun Microsystems Inc.)All classes and resources in a jar file containing this manifest attribute must be signed and trusted.看它的介绍的话还是因为应用中涉及到了unsigned components,所以才需要这个属性
已验证。我都尝试过了……最终只能这样!还是谢谢啦!
Trusted-Only: true
Created-By: 1.6.0-internal (Sun Microsystems Inc.)All classes and resources in the application or applet must be signed and trusted.
可是我确实没有用第三方jar包,又不敢你这样,害怕真有人改jar包,运行其它代码