我使用Eclipse创建了一个java应用程序。创建应用程序后,我希望能够自动更新。因此我尝试开始使用Java Web Start。这是我生成密钥库,将密钥库分配给jar文件,创建jnlp文件以及将所有内容上传到服务器的过程。
我在jar的位置的命令提示符下键入以下内容创建了一个密钥库:
keytool -genkey -keystore NameOfKey -alias MyAliasName
我被提示并回答了以下问题:
password: password1
rePassword: password1
What is your first and last name? [Unknown]: John Smith
What is the name of your organizational unit? [Unknown]: Development
What is the name of your organization? [Unknown]: App Co
What is the name of your City or Location? [Unknown]: Dallas
What is the name of your State or Province? [Unknown]: Texas
What is the two-letter Country code for this unit? [Unknown]: US
Is CN=John Smith, OU=Development, O=App Co, L=Dallas, ST=Texas, C=US correct? [no]: yes
Enter key password for <MyAliasName>
(RETURN if same as keystore password):
我按了回来。并且创建了NameOfKey。 接下来,我将密钥库分配给jar文件,打开命令提示符导航到密钥库的位置并输入以下内容:
jarsigner -keystore NameOfKey MyApplication.jar MyAliasName
Enter Passphrase for keystore: password1
jar signed.
Warning:
The signer certificate will expire within six months.
No -tsa or -tsacert is provided and this jar is not timestamped. Without a times
tamp, users may not be able to validate this jar after the signer certificate's
expiration date (2014-08-27) or after any future revocation date.
我的Myjnlp.jnlp文件如下:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://example.com/Java/" href="Myjnlp.jnlp">
<information>
<title>This is my Title</title>
<vendor>App Co</vendor>
<homepage href="http://example.com" />
<description>Testing Testing</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" />
<jar href="MyApplication.jar" />
</resources>
<application-desc main-class="org.eclipse.wb.swing.SwingAppWindow" />
</jnlp>
我将MyApplication.jar,Myjnlp.jnlp和NameOfKey存储在位于http://example.com/Java/的我的网站上。我可以去http://example.com/Java/Myjnlp.jnlp我下载jnlp,当我尝试运行它时,我收到以下错误。
Unable to launch the application.
com.sun.deploy.net.JARSigningException: Found unsigned entry in resource: http://example.com/Java/MyApplication.jar
at com.sun.javaws.security.SigningInfo.check(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
非常感谢任何帮助。谢谢!