看了 Swing 的
Java Web Start 學(xué)習(xí) 正好自己也寫了一個Java Application, 而同事是用Mac,他不太會設(shè)java 環(huán)境, 于是決定把自己的application 放在server 上, 用Java Web Start 技術(shù),這樣就方便別人使用.
1.keystore的有效時間
keytool -genkey -keystore myKeystore -alias jwstest -validity 365
用 -validity valDays 來設(shè)定, 缺省的是 6個月
2.Sign Jar文件
jarsigner -keystore myKeystore -storepass xxxx yourtest.jar jwstest
直接用 storepass 傳password 給jarsigner, 不需要每次單獨(dú)輸入, 很適合做批處理,對多個Jar一起sign. 因?yàn)橛肑WS,所以引用的Jar都需要Sign.
3. 引用的已經(jīng)被別人Sign 過的Jar
如果不特殊處理,可能會遇到 Exception
JAR resources in JNLP file are not signed by same certificate
驗(yàn)證JAR 是不是已經(jīng)被sign 可以用-verfiy這個命令
jarsigner -certs -verbose -verify yourtest.jar
通常解決的辦法是把這個Sign過的JAR 寫成單獨(dú)的JNLP, 然后在自己的主JNLP中引用它

<?xml version="1.0" encoding="UTF-8"?>

<jnlp spec="1.0+" codebase="http://localhost:8080/webstart/" href="signedjar.jnlp">

<information>

<title>Signed Jar</title>

<vendor>ABC Company</vendor>

<offline-allowed/>

</information>

<offline-allowed/>
<resources>
<jar href="signed.jar"/>
</resources>

<component-desc/>

</jnlp>

參考網(wǎng)站
http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/contents.htmlhttp://weblogs.java.net/blog/kirillcool/archive/2005/05/signing_jars_fo.html
posted on 2008-11-14 15:07
happyy2k 閱讀(1286)
評論(0) 編輯 收藏 所屬分類:
JAVA