gpt4 book ai didi

java - 更改 netbeans 中的 list (Trusted-Library=true 属性)

转载 作者:行者123 更新时间:2023-11-30 04:24:45 24 4
gpt4 key购买 nike

我需要使用 Trusted-Library=true 属性来标记 JAR 文件...不知何故。当我在 list 中添加 Trusted-Library=true 时,出现类未找到异常。我在 Netbeans 中看到的 list 是,

 Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

当我使用项目属性中的 Webstart 选项并从签名部分选择 Trusted-Library 时,我找不到相同的类。

我能做什么?

编辑:jar 中的 list :

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
X-COMMENT: Main-Class will be added automatically by build
Created-By: 1.6.0_45-b06 (Sun Microsystems Inc.)

Name: JTwainLicense.class
SHA1-Digest: L4BTAOFRNEyeRA9Tw1Z3EQ0Ud5c=

Name: com/asprise/util/jtwain/web/TestApplet.class
SHA1-Digest: 8EetVUQhuvNH4urJB3oDG66vYas=

Name: com/asprise/util/jtwain/web/TestConstants.class
SHA1-Digest: ycjvP24IF/ggDBtj4v/r5Bz5nBY=

Name: com/asprise/util/jtwain/web/TestApplet_buttonScan_actionAdapter.class
SHA1-Digest: EWMDyf2p4ka8jOD8Fr2Fbrj/Tf0=

Name: META-INF/INDEX.LIST
SHA1-Digest: ymizlIYUM8SXgYNjYA30r1G0X7A=

Name: com/asprise/util/jtwain/web/ImageDisplayPanel.class
SHA1-Digest: Ae0oc23YVy8W9oTJoiRT2M1o4cY=

未找到类错误的 list 。

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
X-COMMENT: Main-Class will be added automatically by build
Trusted-library: true
Created-By: 1.6.0_45-b06 (Sun Microsystems Inc.)

Name: JTwainLicense.class
SHA1-Digest: L4BTAOFRNEyeRA9Tw1Z3EQ0Ud5c=

Name: com/asprise/util/jtwain/web/TestApplet.class
SHA1-Digest: 8EetVUQhuvNH4urJB3oDG66vYas=

Name: com/asprise/util/jtwain/web/TestConstants.class
SHA1-Digest: ycjvP24IF/ggDBtj4v/r5Bz5nBY=

Name: com/asprise/util/jtwain/web/TestApplet_buttonScan_actionAdapter.class
SHA1-Digest: EWMDyf2p4ka8jOD8Fr2Fbrj/Tf0=

Name: META-INF/INDEX.LIST
SHA1-Digest: ymizlIYUM8SXgYNjYA30r1G0X7A=

Name: com/asprise/util/jtwain/web/ImageDisplayPanel.class
SHA1-Digest: Ae0oc23YVy8W9oTJoiRT2M1o4cY=

堆栈跟踪:

ERROR: com/asprise/util/jtwain/SourceManager
Exception in thread "AWT-EventQueue-3" java.lang.NoClassDefFoundError: com/asprise/util/jtwain/SourceManager
at com.asprise.util.jtwain.web.TestApplet.buttonScan_actionPerformed(UploadApplet.java:388)
at com.asprise.util.jtwain.web.TestApplet_buttonScan_actionAdapter.actionPerformed(UploadApplet.java:548)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
....

最佳答案

使用 Trusted-Library: true 会使 jar 文件加载到单独的类加载器中,该类加载器是加载 Applet/WebStart 应用程序的类加载器的父级。

参见:https://forums.oracle.com/forums/thread.jspa?threadID=2278127并且还可以看到: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/mixed_code.html

这意味着您的可信代码无法访问不可信代码,除非通过 Thread.currentThread().getContextClassLoader()。

您还可以将 Trusted-Library: true 添加到您依赖的所有 jar 中。

关于java - 更改 netbeans 中的 list (Trusted-Library=true 属性),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16235076/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com