本文介绍了签署我的Jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经制作了一个Java Swing GUI,并且我试图把它放到一个网站上,我已将我的html文件放在lwjgl_jar文件夹中并解决了关于无法找到AppletLoader但我现在收到一个新错误:

I have made a Java Swing GUI and am trying to put it onto a website, I have put my html file in the lwjgl_jar folder and that solved my previous problem about not being able to find the AppletLoader but I am now getting a new error:

Permissions for Applet Refused. Please accept the permissions dialogue to allow the applet to continue the loading process.

告诉Java运行此时间后出现错误。所以我在网上搜索,发现我的问题的解决方案是我的jar文件还没有签名,这很奇怪,考虑到我使用Slick和lwjgl文件,我认为应该已经签名,但是我的racegame.jar,其中包含我的小程序可能需要签名,所以我按照:

The error appeared after telling Java to "run this time". So I searched online and found the solution to my problem is that the my jar files have not been signed, which is strange considering that I am using Slick and lwjgl files which I think should already be signed, but my racegame.jar which holds my applet may need signing, so I followed this guide to signing jars:

并进入最后一步并键入: jarsigner -keystore myKeystore racegame.jar我自己
签署我的racegame.jar但它说:

and got to the last step and typed: jarsigner -keystore myKeystore racegame.jar myselfto sign my racegame.jar but it said:

jarsigner: unable to open jar file: racegame.jar

我尝试使用的任何其他jar文件也会出现此错误。

This error also occurs with any other jar file I try it with.

为什么不打开jar文件并签名呢?所有其他步骤都遵循并完全按照指南中的说明进行测试。

Why is it not opening the jar file and signing it? all the other steps were followed and tested exactly like they where shown in the guide.

推荐答案

我曾在网上发现这篇关于的文章如何签署JAR文件,这可能有一些内容,这可以在某种程度上帮助你。请看看:

I once found this article on the net regarding How to sign the JAR Files, this might can have some contents, which can help you in some way. Please have a look :

Sign All Applet JAR files

Applets are back! And now applets can do more than ever before thanks to
signed JAR files. By signing your JARs, you can get access to the filesystem
and other resources that were previously off-limits, provided the user
grants your applet those privileges. And signing JAR files is now very easy
thanks to tools bundled with the JDK. However, be certain to sign all JAR files
used by your Java applet. If you sign the JAR file with your main applet class,
your applet will launch. If it later uses classes from another JAR file, though,
you can run into trouble. If the newly-loaded class tries a restricted operation
and its JAR file isn't signed, your applet will fail at that point with a
security exception. Rather than waiting for this and debugging it when it occurs,
save yourself the trouble and sign all of your JAR files up front.

You can create your own certificate using tools provided by the JDK.
keytool -genkey -alias mykey lets you create your own certificate. Be sure to
specify an expiration date far in the future with -validity 1000. The default is
only 6 months.

Sign your JAR files with jarsigner my.jar mykey (where my.jar is the name of
the jar file to sign).

Deploy all of your JAR files to a folder on your web server, add an HTML page
with the applet tag, and let the world enjoy your new applet with powerful
permissions.

keytool -genkey -v -key store mycompany.keystore -alias myalias_goes_here -keyalg RSA -keysize 2048 -validity 10000

这篇关于签署我的Jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 08:28