3

Java Swing GUI を作成し、それを Web サイトに配置しようとしています。html ファイルを lwjgl_jar フォルダーに配置し、AppletLoader が見つからないという以前の問題を解決しましたが、新しいエラーが発生しました。

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

Javaに「今回は実行する」ように指示した後、エラーが表示されました。オンラインで検索したところ、問題の解決策は、jarファイルが署名されていないことであることがわかりました。これは、すでに署名されているはずのSlickおよびlwjglファイルを使用していることを考えると奇妙ですが、私を保持するracegame.jarアプレットには署名が必要な場合があるため、このガイドに従って jar に署名しました

最後のステップに到達して、次のように入力しました:jarsigner -keystore myKeystore racegame.jar myself to sign my racegame.jar が、次のように述べています:

jarsigner: unable to open jar file: racegame.jar

このエラーは、私が試した他のjarファイルでも発生します。

jarファイルを開いて署名しないのはなぜですか? 他のすべての手順は、ガイドに示されているのとまったく同じように実行され、テストされました。

4

1 に答える 1

1

についてネットでこの記事を見つけたHow to sign the JAR Filesことがあります。これには何らかの内容が含まれている可能性があり、何らかの形で役立つ可能性があります。ご覧ください:

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
于 2013-01-14T14:35:04.303 に答える