附件是客户端代码,做了一些改造。主要是清除一些模块之间的关联,避免关联下载。
为了更快的启动客户端、最少的下载gui更新程序,我尝试了如下做法:
1. 个模块分开打包。目前粒度是对各第三方jar包、common目录、gui下的个子目录、gui目录本身做了单独打包、签名、pack200;
2. 设置各个包的下载策略。对于少数必须包,用eager;对于非必须包(例如各模块包、itext包等),一律用lazy处理;
3. 首次启动客户端,尽可能快、少下载包。目前可以只下载必要包(见后续列表,并且还有改进潜力)。目前可以做到LoginUI出现时,不下载任何业务模块。
4. 由于MainUI关联了不少各模块的东西(例如工具栏上有一些业务模块的快捷入口),启动程序时候应当避免加载MainUI类。所以,改造XXX的main函数到Main.java中,而不再放在MainUI中;
5. 通过观察以前代码jnlp的jar加载发现,login界面出来时候eng包竟然已经被加载。调试发现ClientInitialize类中调用了PartType数量。必要性不大,去掉之;
6. 启动MainUI,什么也没动的情况下,发现几乎所有业务模块jar都被加载。原因是:MainUIActionManager里面的clear方法在清除缓存时候,用硬编码调用各个模块的类的静态方法进行clear,导致这些jar包全都被加载。做如下改造:在MainUIActionManager中做一个map存储所有待清除类,用类名和方法名记录clear cache的方法;各个具体模块的类如果有需要logout被清除的,在类的开始处用static代码段调用 MainUIActionManager.registerClearCache来注册自己。这样,MainUIActionManager就不必知道每个被清除者,谁注册谁会被回调。这里的缺点是:由于这些clear方法都是static的,无法用接口来定义,java没有abstract static这样的概念,这里只能用反射,有一定的出错概率。经过这个改造,mainUI启动后,业务模块大多没有load,只有eng、sales和 manage来死活在上面。
7. 继续研究eng模块jar包总是被加载。发现原因是:默认进来的HomePage就是PartHomePage。这个看来没招了。不过sales和manage还要研究。
8. 继续发现:part首页出现后,sales模块总是被加载。后来发现是AbstractHomePage类中的addInfoCenterTab方法中,竟然用SalesUtil.getString获得tab的title字符串。去掉,sales模块不再加载。
9. 继续发现:part首页出现后,manage模块jar总是被加载。后来发现,part首页的infoCenter要显示InfoCenter的UI,而这些类是在manage包内定义的。抽出来放在eng模块,让manage引用eng模块。manage模块不再被加载。
通过以上改造,首次运行XXX,到LoginUI显示时,加载的XXX的包如下:
XXX-base.jar
XXX-common.jar
XXX-gui.jar
XXX-i18n.jar
XXX-image.jar
XXX-server.jar
XXX-swing.jar
org.jar
第三方包有:
commons-lang.jar
jbossall-client.jar
looks-1.3.1.jar
twaver.jar
总计大小:3.439m。而且应当还有改进潜力。
点击login到进入MainUI,期间被加载的包有:
XXX-comany
XXX-conf
XXX-message
XXX-print
XXX-security
总计大小(包含前面加载的):3.995m
如果点击树将各个模块触发全部jar下载,累计总计大小:7.116m
以后:
* 如果某个业务模块被具体更新:从双击jnlp到MainUI显示出来未做任何动作之前,没有任何下载产生(相当于直接启动);点击对应的模块树会触发下载,但一般模块包的jar包都在1m以下,相当于下载一个新闻网页,略感延迟但不明显;只要下载服务器和客户端网络较好,基本感觉不到更新;
* 如果客户端基本包(包括common、gui包、image、base、swing等)被更新,双击jnlp会触发进度条进行下载更新,不过会提示,用户可以选择;这是因为在jnlp中做了如下设置:<update check="background" policy="prompt-update"/>,用户可以选择不更新而启动客户端(当然这样风险相当大);
* 如果第三方包被更新:同上。
附件的jnlp文件是新版本,可以看一下。为了方便管理众多gz和jar文件,将所有压缩包放入webstart/jars目录下,上层目录只留下index.htm和jnlp文件。
附件中的bat文件,可以将class文件进行打包、repack、签名、pack200压缩、生成对应的空jar文件、move到jboss目录,一次搞定(使用前需要修改一下里面的目录)。
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
codebase="http://192.168.1.100:8080/webstart/"
href="XXX.jnlp">
<information>
<title>2BizBox v2</title>
<vendor>SERVA Software</vendor>
<homepage href="http://www.servasoft.com"/>
<description>XXX</description>
<description kind="short">SERVA Software 2BizBox 2.0.</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<update check="background" policy="prompt-update"/>
<resources>
<j2se version="1.5+" initial-heap-size="128m" max-heap-size="512m"/>
<jar href="jars/XXX-common.jar" part="XXX-common" download="eager"/>
<jar href="jars/XXX-gui.jar" part="XXX-gui" download="eager" main="true"/>
<jar href="jars/org.jar" part="XXX-gui" download="eager"/>
<!-- 2bizbox lazy modules -->
<jar href="jars/XXX-acc.jar" part="XXX-acc" download="lazy"/>
<package name="com.serva.XXX.gui.acc.*" part="XXX-acc" recursive="true"/>
<jar href="jars/XXX-addr.jar" part="XXX-addr" download="lazy"/>
<package name="com.serva.XXX.gui.addr.*" part="XXX-addr" recursive="true"/>
<jar href="jars/XXX-base.jar" part="XXX-base" download="lazy"/>
<package name="com.serva.XXX.gui.base.*" part="XXX-base" recursive="true"/>
<jar href="jars/XXX-chart.jar" part="XXX-chart" download="lazy"/>
<package name="com.serva.XXX.gui.chart.*" part="XXX-chart" recursive="true"/>
<jar href="jars/XXX-company.jar" part="XXX-company" download="lazy"/>
<package name="com.serva.XXX.gui.company.*" part="XXX-company" recursive="true"/>
<jar href="jars/XXX-conf.jar" part="XXX-conf" download="lazy"/>
<package name="com.serva.XXX.gui.conf.*" part="XXX-conf" recursive="true"/>
<jar href="jars/XXX-cs.jar" part="XXX-cs" download="lazy"/>
<package name="com.serva.XXX.gui.cs.*" part="XXX-cs" recursive="true"/>
<jar href="jars/XXX-dev.jar" part="XXX-dev" download="lazy"/>
<package name="com.serva.XXX.gui.dev.*" part="XXX-dev" recursive="true"/>
<jar href="jars/XXX-doc.jar" part="XXX-doc" download="lazy"/>
<package name="com.serva.XXX.gui.doc.*" part="XXX-doc" recursive="true"/>
<jar href="jars/XXX-eng.jar" part="XXX-eng" download="lazy"/>
<package name="com.serva.XXX.gui.eng.*" part="XXX-eng" recursive="true"/>
<jar href="jars/XXX-hr.jar" part="XXX-hr" download="lazy"/>
<package name="com.serva.XXX.gui.hr.*" part="XXX-hr" recursive="true"/>
<jar href="jars/XXX-i18n.jar" part="XXX-i18n" download="lazy"/>
<package name="com.serva.XXX.gui.i18n.*" part="XXX-i18n" recursive="true"/>
<jar href="jars/XXX-images.jar" part="XXX-images" download="lazy"/>
<package name="com.serva.XXX.gui.images.*" part="XXX-images" recursive="true"/>
<jar href="jars/XXX-log.jar" part="XXX-log" download="lazy"/>
<package name="com.serva.XXX.gui.log.*" part="XXX-log" recursive="true"/>
<jar href="jars/XXX-man.jar" part="XXX-man" download="lazy"/>
<package name="com.serva.XXX.gui.man.*" part="XXX-man" recursive="true"/>
<jar href="jars/XXX-manage.jar" part="XXX-manage" download="lazy"/>
<package name="com.serva.XXX.gui.manage.*" part="XXX-manage" recursive="true"/>
<jar href="jars/XXX-message.jar" part="XXX-message" download="lazy"/>
<package name="com.serva.XXX.gui.message.*" part="XXX-message" recursive="true"/>
<jar href="jars/XXX-plan.jar" part="XXX-plan" download="lazy"/>
<package name="com.serva.XXX.gui.plan.*" part="XXX-plan" recursive="true"/>
<jar href="jars/XXX-print.jar" part="XXX-print" download="lazy"/>
<package name="com.serva.XXX.gui.print.*" part="XXX-print" recursive="true"/>
<jar href="jars/XXX-pur.jar" part="XXX-pur" download="lazy"/>
<package name="com.serva.XXX.gui.pur.*" part="XXX-pur" recursive="true"/>
<jar href="jars/XXX-quality.jar" part="XXX-quality" download="lazy"/>
<package name="com.serva.XXX.gui.quality.*" part="XXX-quality" recursive="true"/>
<jar href="jars/XXX-rule.jar" part="XXX-rule" download="lazy"/>
<package name="com.serva.XXX.gui.rule.*" part="XXX-rule" recursive="true"/>
<jar href="jars/XXX-sales.jar" part="XXX-sales" download="lazy"/>
<package name="com.serva.XXX.gui.sales.*" part="XXX-sales" recursive="true"/>
<jar href="jars/XXX-security.jar" part="XXX-security" download="lazy"/>
<package name="com.serva.XXX.gui.security.*" part="XXX-security" recursive="true"/>
<jar href="jars/XXX-server.jar" part="XXX-server" download="lazy"/>
<package name="com.serva.XXX.gui.server.*" part="XXX-server" recursive="true"/>
<jar href="jars/XXX-swing.jar" part="XXX-swing" download="lazy"/>
<package name="com.serva.XXX.gui.swing.*" part="XXX-swing" recursive="true"/>
<jar href="jars/XXX-tools.jar" part="XXX-tools" download="lazy"/>
<package name="com.serva.XXX.gui.tools.*" part="XXX-tools" recursive="true"/>
<jar href="jars/XXX-ware.jar" part="XXX-ware" download="lazy"/>
<package name="com.serva.XXX.gui.ware.*" part="XXX-ware" recursive="true"/>
<jar href="jars/XXX-wo.jar" part="XXX-wo" download="lazy"/>
<package name="com.serva.XXX.gui.wo.*" part="XXX-wo" recursive="true"/>
<!-- all third party components -->
<jar href="jars/looks-1.3.1.jar" download="eager"/>
<jar href="jars/jbossall-client.jar" download="eager"/>
<jar href="jars/commons-lang-1.0.1.jar" download="eager"/>
<jar href="jars/itext-1.4.4.jar" part="itext" download="lazy"/>
<jar href="jars/iTextAsian.jar" part="itext" download="lazy"/>
<package name="com.lowagie.*" part="itext" recursive="true"/>
<jar href="jars/twaver.jar" part="twaver" download="lazy"/>
<package name="twaver.*" part="twaver" recursive="true"/>
<jar href="jars/jxl.jar" part="jxl" download="lazy"/>
<package name="jxl.*" part="jxl" recursive="true"/>
<jar href="jars/barbecue.jar" part="barbecue" download="lazy"/>
<package name="net.sourceforge.barbecue.*" part="barbecue" recursive="true"/>
</resources>
<application-desc main-class="com.serva.XXX.gui.Main">
<argument>localhost</argument>
</application-desc>
</jnlp>
pack.bat
cd classes
del /q *.jar
cd ..
rmdir -Q jars-gui
mkdir jars-gui
cd classes
jar -cf XXX-common.jar com/serva/XXX/common
jar -cf XXX-gui.jar com/serva/XXX/gui/*.class com/serva/XXX/gui/*.dat
jar -cf XXX-acc.jar com/serva/XXX/gui/acc
jar -cf XXX-addr.jar com/serva/XXX/gui/addr
jar -cf XXX-base.jar com/serva/XXX/gui/base
jar -cf XXX-chart.jar com/serva/XXX/gui/chart
jar -cf XXX-company.jar com/serva/XXX/gui/company
jar -cf XXX-conf.jar com/serva/XXX/gui/conf
jar -cf XXX-cs.jar com/serva/XXX/gui/cs
jar -cf XXX-dev.jar com/serva/XXX/gui/dev
jar -cf XXX-doc.jar com/serva/XXX/gui/doc
jar -cf XXX-eng.jar com/serva/XXX/gui/eng
jar -cf XXX-hr.jar com/serva/XXX/gui/hr
jar -cf XXX-i18n.jar com/serva/XXX/gui/i18n
jar -cf XXX-images.jar com/serva/XXX/gui/images
jar -cf XXX-log.jar com/serva/XXX/gui/log
jar -cf XXX-man.jar com/serva/XXX/gui/man
jar -cf XXX-manage.jar com/serva/XXX/gui/manage
jar -cf XXX-message.jar com/serva/XXX/gui/message
jar -cf XXX-plan.jar com/serva/XXX/gui/plan
jar -cf XXX-print.jar com/serva/XXX/gui/print
jar -cf XXX-pur.jar com/serva/XXX/gui/pur
jar -cf XXX-quality.jar com/serva/XXX/gui/quality
jar -cf XXX-rule.jar com/serva/XXX/gui/rule
jar -cf XXX-sales.jar com/serva/XXX/gui/sales
jar -cf XXX-security.jar com/serva/XXX/gui/security
jar -cf XXX-server.jar com/serva/XXX/gui/server
jar -cf XXX-swing.jar com/serva/XXX/gui/swing
jar -cf XXX-tools.jar com/serva/XXX/gui/tools
jar -cf XXX-ware.jar com/serva/XXX/gui/ware
jar -cf XXX-wo.jar com/serva/XXX/gui/wo
pack200 --repack XXX-common.jar
pack200 --repack XXX-gui.jar
pack200 --repack XXX-acc.jar
pack200 --repack XXX-addr.jar
pack200 --repack XXX-base.jar
pack200 --repack XXX-chart.jar
pack200 --repack XXX-company.jar
pack200 --repack XXX-conf.jar
pack200 --repack XXX-cs.jar
pack200 --repack XXX-dev.jar
pack200 --repack XXX-doc.jar
pack200 --repack XXX-eng.jar
pack200 --repack XXX-hr.jar
pack200 --repack XXX-i18n.jar
pack200 --repack XXX-images.jar
pack200 --repack XXX-log.jar
pack200 --repack XXX-man.jar
pack200 --repack XXX-manage.jar
pack200 --repack XXX-message.jar
pack200 --repack XXX-plan.jar
pack200 --repack XXX-print.jar
pack200 --repack XXX-pur.jar
pack200 --repack XXX-quality.jar
pack200 --repack XXX-rule.jar
pack200 --repack XXX-sales.jar
pack200 --repack XXX-security.jar
pack200 --repack XXX-server.jar
pack200 --repack XXX-swing.jar
pack200 --repack XXX-tools.jar
pack200 --repack XXX-ware.jar
pack200 --repack XXX-wo.jar
jarsigner -keystore ../myKeystore -storepass servasoft XXX-common.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-gui.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-acc.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-addr.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-base.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-chart.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-company.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-conf.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-cs.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-dev.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-doc.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-eng.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-hr.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-i18n.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-images.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-log.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-man.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-manage.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-message.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-plan.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-print.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-pur.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-quality.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-rule.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-sales.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-security.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-server.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-swing.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-tools.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-ware.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-wo.jar XXX
pack200 XXX-common.jar.pack.gz XXX-common.jar
pack200 XXX-gui.jar.pack.gz XXX-gui.jar
pack200 XXX-acc.jar.pack.gz XXX-acc.jar
pack200 XXX-addr.jar.pack.gz XXX-addr.jar
pack200 XXX-base.jar.pack.gz XXX-base.jar
pack200 XXX-chart.jar.pack.gz XXX-chart.jar
pack200 XXX-company.jar.pack.gz XXX-company.jar
pack200 XXX-conf.jar.pack.gz XXX-conf.jar
pack200 XXX-cs.jar.pack.gz XXX-cs.jar
pack200 XXX-dev.jar.pack.gz XXX-dev.jar
pack200 XXX-doc.jar.pack.gz XXX-doc.jar
pack200 XXX-eng.jar.pack.gz XXX-eng.jar
pack200 XXX-hr.jar.pack.gz XXX-hr.jar
pack200 XXX-i18n.jar.pack.gz XXX-i18n.jar
pack200 XXX-images.jar.pack.gz XXX-images.jar
pack200 XXX-log.jar.pack.gz XXX-log.jar
pack200 XXX-man.jar.pack.gz XXX-man.jar
pack200 XXX-manage.jar.pack.gz XXX-manage.jar
pack200 XXX-message.jar.pack.gz XXX-message.jar
pack200 XXX-plan.jar.pack.gz XXX-plan.jar
pack200 XXX-print.jar.pack.gz XXX-print.jar
pack200 XXX-pur.jar.pack.gz XXX-pur.jar
pack200 XXX-quality.jar.pack.gz XXX-quality.jar
pack200 XXX-rule.jar.pack.gz XXX-rule.jar
pack200 XXX-sales.jar.pack.gz XXX-sales.jar
pack200 XXX-security.jar.pack.gz XXX-security.jar
pack200 XXX-server.jar.pack.gz XXX-server.jar
pack200 XXX-swing.jar.pack.gz XXX-swing.jar
pack200 XXX-tools.jar.pack.gz XXX-tools.jar
pack200 XXX-ware.jar.pack.gz XXX-ware.jar
pack200 XXX-wo.jar.pack.gz XXX-wo.jar
del /q *.jar
move *.gz ../jars-gui
cd ../jars-gui
echo nothing > XXX-common.jar
echo nothing > XXX-gui.jar
echo nothing > XXX-acc.jar
echo nothing > XXX-addr.jar
echo nothing > XXX-base.jar
echo nothing > XXX-chart.jar
echo nothing > XXX-company.jar
echo nothing > XXX-conf.jar
echo nothing > XXX-cs.jar
echo nothing > XXX-dev.jar
echo nothing > XXX-doc.jar
echo nothing > XXX-eng.jar
echo nothing > XXX-hr.jar
echo nothing > XXX-i18n.jar
echo nothing > XXX-images.jar
echo nothing > XXX-log.jar
echo nothing > XXX-man.jar
echo nothing > XXX-manage.jar
echo nothing > XXX-message.jar
echo nothing > XXX-plan.jar
echo nothing > XXX-print.jar
echo nothing > XXX-pur.jar
echo nothing > XXX-quality.jar
echo nothing > XXX-rule.jar
echo nothing > XXX-sales.jar
echo nothing > XXX-security.jar
echo nothing > XXX-server.jar
echo nothing > XXX-swing.jar
echo nothing > XXX-tools.jar
echo nothing > XXX-ware.jar
echo nothing > XXX-wo.jar
del -Q C:\jboss-4.0.5\server\default\deploy\webstart.war\jars\XXX-*.*
move *.* C:\jboss-4.0.5\server\default\deploy\webstart.war\jars
cd ..
rmdir -Q jars-gui
为了更快的启动客户端、最少的下载gui更新程序,我尝试了如下做法:
1. 个模块分开打包。目前粒度是对各第三方jar包、common目录、gui下的个子目录、gui目录本身做了单独打包、签名、pack200;
2. 设置各个包的下载策略。对于少数必须包,用eager;对于非必须包(例如各模块包、itext包等),一律用lazy处理;
3. 首次启动客户端,尽可能快、少下载包。目前可以只下载必要包(见后续列表,并且还有改进潜力)。目前可以做到LoginUI出现时,不下载任何业务模块。
4. 由于MainUI关联了不少各模块的东西(例如工具栏上有一些业务模块的快捷入口),启动程序时候应当避免加载MainUI类。所以,改造XXX的main函数到Main.java中,而不再放在MainUI中;
5. 通过观察以前代码jnlp的jar加载发现,login界面出来时候eng包竟然已经被加载。调试发现ClientInitialize类中调用了PartType数量。必要性不大,去掉之;
6. 启动MainUI,什么也没动的情况下,发现几乎所有业务模块jar都被加载。原因是:MainUIActionManager里面的clear方法在清除缓存时候,用硬编码调用各个模块的类的静态方法进行clear,导致这些jar包全都被加载。做如下改造:在MainUIActionManager中做一个map存储所有待清除类,用类名和方法名记录clear cache的方法;各个具体模块的类如果有需要logout被清除的,在类的开始处用static代码段调用 MainUIActionManager.registerClearCache来注册自己。这样,MainUIActionManager就不必知道每个被清除者,谁注册谁会被回调。这里的缺点是:由于这些clear方法都是static的,无法用接口来定义,java没有abstract static这样的概念,这里只能用反射,有一定的出错概率。经过这个改造,mainUI启动后,业务模块大多没有load,只有eng、sales和 manage来死活在上面。
7. 继续研究eng模块jar包总是被加载。发现原因是:默认进来的HomePage就是PartHomePage。这个看来没招了。不过sales和manage还要研究。
8. 继续发现:part首页出现后,sales模块总是被加载。后来发现是AbstractHomePage类中的addInfoCenterTab方法中,竟然用SalesUtil.getString获得tab的title字符串。去掉,sales模块不再加载。
9. 继续发现:part首页出现后,manage模块jar总是被加载。后来发现,part首页的infoCenter要显示InfoCenter的UI,而这些类是在manage包内定义的。抽出来放在eng模块,让manage引用eng模块。manage模块不再被加载。
通过以上改造,首次运行XXX,到LoginUI显示时,加载的XXX的包如下:
XXX-base.jar
XXX-common.jar
XXX-gui.jar
XXX-i18n.jar
XXX-image.jar
XXX-server.jar
XXX-swing.jar
org.jar
第三方包有:
commons-lang.jar
jbossall-client.jar
looks-1.3.1.jar
twaver.jar
总计大小:3.439m。而且应当还有改进潜力。
点击login到进入MainUI,期间被加载的包有:
XXX-comany
XXX-conf
XXX-message
XXX-print
XXX-security
总计大小(包含前面加载的):3.995m
如果点击树将各个模块触发全部jar下载,累计总计大小:7.116m
以后:
* 如果某个业务模块被具体更新:从双击jnlp到MainUI显示出来未做任何动作之前,没有任何下载产生(相当于直接启动);点击对应的模块树会触发下载,但一般模块包的jar包都在1m以下,相当于下载一个新闻网页,略感延迟但不明显;只要下载服务器和客户端网络较好,基本感觉不到更新;
* 如果客户端基本包(包括common、gui包、image、base、swing等)被更新,双击jnlp会触发进度条进行下载更新,不过会提示,用户可以选择;这是因为在jnlp中做了如下设置:<update check="background" policy="prompt-update"/>,用户可以选择不更新而启动客户端(当然这样风险相当大);
* 如果第三方包被更新:同上。
附件的jnlp文件是新版本,可以看一下。为了方便管理众多gz和jar文件,将所有压缩包放入webstart/jars目录下,上层目录只留下index.htm和jnlp文件。
附件中的bat文件,可以将class文件进行打包、repack、签名、pack200压缩、生成对应的空jar文件、move到jboss目录,一次搞定(使用前需要修改一下里面的目录)。
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
codebase="http://192.168.1.100:8080/webstart/"
href="XXX.jnlp">
<information>
<title>2BizBox v2</title>
<vendor>SERVA Software</vendor>
<homepage href="http://www.servasoft.com"/>
<description>XXX</description>
<description kind="short">SERVA Software 2BizBox 2.0.</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<update check="background" policy="prompt-update"/>
<resources>
<j2se version="1.5+" initial-heap-size="128m" max-heap-size="512m"/>
<jar href="jars/XXX-common.jar" part="XXX-common" download="eager"/>
<jar href="jars/XXX-gui.jar" part="XXX-gui" download="eager" main="true"/>
<jar href="jars/org.jar" part="XXX-gui" download="eager"/>
<!-- 2bizbox lazy modules -->
<jar href="jars/XXX-acc.jar" part="XXX-acc" download="lazy"/>
<package name="com.serva.XXX.gui.acc.*" part="XXX-acc" recursive="true"/>
<jar href="jars/XXX-addr.jar" part="XXX-addr" download="lazy"/>
<package name="com.serva.XXX.gui.addr.*" part="XXX-addr" recursive="true"/>
<jar href="jars/XXX-base.jar" part="XXX-base" download="lazy"/>
<package name="com.serva.XXX.gui.base.*" part="XXX-base" recursive="true"/>
<jar href="jars/XXX-chart.jar" part="XXX-chart" download="lazy"/>
<package name="com.serva.XXX.gui.chart.*" part="XXX-chart" recursive="true"/>
<jar href="jars/XXX-company.jar" part="XXX-company" download="lazy"/>
<package name="com.serva.XXX.gui.company.*" part="XXX-company" recursive="true"/>
<jar href="jars/XXX-conf.jar" part="XXX-conf" download="lazy"/>
<package name="com.serva.XXX.gui.conf.*" part="XXX-conf" recursive="true"/>
<jar href="jars/XXX-cs.jar" part="XXX-cs" download="lazy"/>
<package name="com.serva.XXX.gui.cs.*" part="XXX-cs" recursive="true"/>
<jar href="jars/XXX-dev.jar" part="XXX-dev" download="lazy"/>
<package name="com.serva.XXX.gui.dev.*" part="XXX-dev" recursive="true"/>
<jar href="jars/XXX-doc.jar" part="XXX-doc" download="lazy"/>
<package name="com.serva.XXX.gui.doc.*" part="XXX-doc" recursive="true"/>
<jar href="jars/XXX-eng.jar" part="XXX-eng" download="lazy"/>
<package name="com.serva.XXX.gui.eng.*" part="XXX-eng" recursive="true"/>
<jar href="jars/XXX-hr.jar" part="XXX-hr" download="lazy"/>
<package name="com.serva.XXX.gui.hr.*" part="XXX-hr" recursive="true"/>
<jar href="jars/XXX-i18n.jar" part="XXX-i18n" download="lazy"/>
<package name="com.serva.XXX.gui.i18n.*" part="XXX-i18n" recursive="true"/>
<jar href="jars/XXX-images.jar" part="XXX-images" download="lazy"/>
<package name="com.serva.XXX.gui.images.*" part="XXX-images" recursive="true"/>
<jar href="jars/XXX-log.jar" part="XXX-log" download="lazy"/>
<package name="com.serva.XXX.gui.log.*" part="XXX-log" recursive="true"/>
<jar href="jars/XXX-man.jar" part="XXX-man" download="lazy"/>
<package name="com.serva.XXX.gui.man.*" part="XXX-man" recursive="true"/>
<jar href="jars/XXX-manage.jar" part="XXX-manage" download="lazy"/>
<package name="com.serva.XXX.gui.manage.*" part="XXX-manage" recursive="true"/>
<jar href="jars/XXX-message.jar" part="XXX-message" download="lazy"/>
<package name="com.serva.XXX.gui.message.*" part="XXX-message" recursive="true"/>
<jar href="jars/XXX-plan.jar" part="XXX-plan" download="lazy"/>
<package name="com.serva.XXX.gui.plan.*" part="XXX-plan" recursive="true"/>
<jar href="jars/XXX-print.jar" part="XXX-print" download="lazy"/>
<package name="com.serva.XXX.gui.print.*" part="XXX-print" recursive="true"/>
<jar href="jars/XXX-pur.jar" part="XXX-pur" download="lazy"/>
<package name="com.serva.XXX.gui.pur.*" part="XXX-pur" recursive="true"/>
<jar href="jars/XXX-quality.jar" part="XXX-quality" download="lazy"/>
<package name="com.serva.XXX.gui.quality.*" part="XXX-quality" recursive="true"/>
<jar href="jars/XXX-rule.jar" part="XXX-rule" download="lazy"/>
<package name="com.serva.XXX.gui.rule.*" part="XXX-rule" recursive="true"/>
<jar href="jars/XXX-sales.jar" part="XXX-sales" download="lazy"/>
<package name="com.serva.XXX.gui.sales.*" part="XXX-sales" recursive="true"/>
<jar href="jars/XXX-security.jar" part="XXX-security" download="lazy"/>
<package name="com.serva.XXX.gui.security.*" part="XXX-security" recursive="true"/>
<jar href="jars/XXX-server.jar" part="XXX-server" download="lazy"/>
<package name="com.serva.XXX.gui.server.*" part="XXX-server" recursive="true"/>
<jar href="jars/XXX-swing.jar" part="XXX-swing" download="lazy"/>
<package name="com.serva.XXX.gui.swing.*" part="XXX-swing" recursive="true"/>
<jar href="jars/XXX-tools.jar" part="XXX-tools" download="lazy"/>
<package name="com.serva.XXX.gui.tools.*" part="XXX-tools" recursive="true"/>
<jar href="jars/XXX-ware.jar" part="XXX-ware" download="lazy"/>
<package name="com.serva.XXX.gui.ware.*" part="XXX-ware" recursive="true"/>
<jar href="jars/XXX-wo.jar" part="XXX-wo" download="lazy"/>
<package name="com.serva.XXX.gui.wo.*" part="XXX-wo" recursive="true"/>
<!-- all third party components -->
<jar href="jars/looks-1.3.1.jar" download="eager"/>
<jar href="jars/jbossall-client.jar" download="eager"/>
<jar href="jars/commons-lang-1.0.1.jar" download="eager"/>
<jar href="jars/itext-1.4.4.jar" part="itext" download="lazy"/>
<jar href="jars/iTextAsian.jar" part="itext" download="lazy"/>
<package name="com.lowagie.*" part="itext" recursive="true"/>
<jar href="jars/twaver.jar" part="twaver" download="lazy"/>
<package name="twaver.*" part="twaver" recursive="true"/>
<jar href="jars/jxl.jar" part="jxl" download="lazy"/>
<package name="jxl.*" part="jxl" recursive="true"/>
<jar href="jars/barbecue.jar" part="barbecue" download="lazy"/>
<package name="net.sourceforge.barbecue.*" part="barbecue" recursive="true"/>
</resources>
<application-desc main-class="com.serva.XXX.gui.Main">
<argument>localhost</argument>
</application-desc>
</jnlp>
pack.bat
cd classes
del /q *.jar
cd ..
rmdir -Q jars-gui
mkdir jars-gui
cd classes
jar -cf XXX-common.jar com/serva/XXX/common
jar -cf XXX-gui.jar com/serva/XXX/gui/*.class com/serva/XXX/gui/*.dat
jar -cf XXX-acc.jar com/serva/XXX/gui/acc
jar -cf XXX-addr.jar com/serva/XXX/gui/addr
jar -cf XXX-base.jar com/serva/XXX/gui/base
jar -cf XXX-chart.jar com/serva/XXX/gui/chart
jar -cf XXX-company.jar com/serva/XXX/gui/company
jar -cf XXX-conf.jar com/serva/XXX/gui/conf
jar -cf XXX-cs.jar com/serva/XXX/gui/cs
jar -cf XXX-dev.jar com/serva/XXX/gui/dev
jar -cf XXX-doc.jar com/serva/XXX/gui/doc
jar -cf XXX-eng.jar com/serva/XXX/gui/eng
jar -cf XXX-hr.jar com/serva/XXX/gui/hr
jar -cf XXX-i18n.jar com/serva/XXX/gui/i18n
jar -cf XXX-images.jar com/serva/XXX/gui/images
jar -cf XXX-log.jar com/serva/XXX/gui/log
jar -cf XXX-man.jar com/serva/XXX/gui/man
jar -cf XXX-manage.jar com/serva/XXX/gui/manage
jar -cf XXX-message.jar com/serva/XXX/gui/message
jar -cf XXX-plan.jar com/serva/XXX/gui/plan
jar -cf XXX-print.jar com/serva/XXX/gui/print
jar -cf XXX-pur.jar com/serva/XXX/gui/pur
jar -cf XXX-quality.jar com/serva/XXX/gui/quality
jar -cf XXX-rule.jar com/serva/XXX/gui/rule
jar -cf XXX-sales.jar com/serva/XXX/gui/sales
jar -cf XXX-security.jar com/serva/XXX/gui/security
jar -cf XXX-server.jar com/serva/XXX/gui/server
jar -cf XXX-swing.jar com/serva/XXX/gui/swing
jar -cf XXX-tools.jar com/serva/XXX/gui/tools
jar -cf XXX-ware.jar com/serva/XXX/gui/ware
jar -cf XXX-wo.jar com/serva/XXX/gui/wo
pack200 --repack XXX-common.jar
pack200 --repack XXX-gui.jar
pack200 --repack XXX-acc.jar
pack200 --repack XXX-addr.jar
pack200 --repack XXX-base.jar
pack200 --repack XXX-chart.jar
pack200 --repack XXX-company.jar
pack200 --repack XXX-conf.jar
pack200 --repack XXX-cs.jar
pack200 --repack XXX-dev.jar
pack200 --repack XXX-doc.jar
pack200 --repack XXX-eng.jar
pack200 --repack XXX-hr.jar
pack200 --repack XXX-i18n.jar
pack200 --repack XXX-images.jar
pack200 --repack XXX-log.jar
pack200 --repack XXX-man.jar
pack200 --repack XXX-manage.jar
pack200 --repack XXX-message.jar
pack200 --repack XXX-plan.jar
pack200 --repack XXX-print.jar
pack200 --repack XXX-pur.jar
pack200 --repack XXX-quality.jar
pack200 --repack XXX-rule.jar
pack200 --repack XXX-sales.jar
pack200 --repack XXX-security.jar
pack200 --repack XXX-server.jar
pack200 --repack XXX-swing.jar
pack200 --repack XXX-tools.jar
pack200 --repack XXX-ware.jar
pack200 --repack XXX-wo.jar
jarsigner -keystore ../myKeystore -storepass servasoft XXX-common.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-gui.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-acc.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-addr.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-base.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-chart.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-company.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-conf.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-cs.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-dev.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-doc.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-eng.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-hr.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-i18n.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-images.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-log.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-man.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-manage.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-message.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-plan.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-print.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-pur.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-quality.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-rule.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-sales.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-security.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-server.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-swing.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-tools.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-ware.jar XXX
jarsigner -keystore ../myKeystore -storepass servasoft XXX-wo.jar XXX
pack200 XXX-common.jar.pack.gz XXX-common.jar
pack200 XXX-gui.jar.pack.gz XXX-gui.jar
pack200 XXX-acc.jar.pack.gz XXX-acc.jar
pack200 XXX-addr.jar.pack.gz XXX-addr.jar
pack200 XXX-base.jar.pack.gz XXX-base.jar
pack200 XXX-chart.jar.pack.gz XXX-chart.jar
pack200 XXX-company.jar.pack.gz XXX-company.jar
pack200 XXX-conf.jar.pack.gz XXX-conf.jar
pack200 XXX-cs.jar.pack.gz XXX-cs.jar
pack200 XXX-dev.jar.pack.gz XXX-dev.jar
pack200 XXX-doc.jar.pack.gz XXX-doc.jar
pack200 XXX-eng.jar.pack.gz XXX-eng.jar
pack200 XXX-hr.jar.pack.gz XXX-hr.jar
pack200 XXX-i18n.jar.pack.gz XXX-i18n.jar
pack200 XXX-images.jar.pack.gz XXX-images.jar
pack200 XXX-log.jar.pack.gz XXX-log.jar
pack200 XXX-man.jar.pack.gz XXX-man.jar
pack200 XXX-manage.jar.pack.gz XXX-manage.jar
pack200 XXX-message.jar.pack.gz XXX-message.jar
pack200 XXX-plan.jar.pack.gz XXX-plan.jar
pack200 XXX-print.jar.pack.gz XXX-print.jar
pack200 XXX-pur.jar.pack.gz XXX-pur.jar
pack200 XXX-quality.jar.pack.gz XXX-quality.jar
pack200 XXX-rule.jar.pack.gz XXX-rule.jar
pack200 XXX-sales.jar.pack.gz XXX-sales.jar
pack200 XXX-security.jar.pack.gz XXX-security.jar
pack200 XXX-server.jar.pack.gz XXX-server.jar
pack200 XXX-swing.jar.pack.gz XXX-swing.jar
pack200 XXX-tools.jar.pack.gz XXX-tools.jar
pack200 XXX-ware.jar.pack.gz XXX-ware.jar
pack200 XXX-wo.jar.pack.gz XXX-wo.jar
del /q *.jar
move *.gz ../jars-gui
cd ../jars-gui
echo nothing > XXX-common.jar
echo nothing > XXX-gui.jar
echo nothing > XXX-acc.jar
echo nothing > XXX-addr.jar
echo nothing > XXX-base.jar
echo nothing > XXX-chart.jar
echo nothing > XXX-company.jar
echo nothing > XXX-conf.jar
echo nothing > XXX-cs.jar
echo nothing > XXX-dev.jar
echo nothing > XXX-doc.jar
echo nothing > XXX-eng.jar
echo nothing > XXX-hr.jar
echo nothing > XXX-i18n.jar
echo nothing > XXX-images.jar
echo nothing > XXX-log.jar
echo nothing > XXX-man.jar
echo nothing > XXX-manage.jar
echo nothing > XXX-message.jar
echo nothing > XXX-plan.jar
echo nothing > XXX-print.jar
echo nothing > XXX-pur.jar
echo nothing > XXX-quality.jar
echo nothing > XXX-rule.jar
echo nothing > XXX-sales.jar
echo nothing > XXX-security.jar
echo nothing > XXX-server.jar
echo nothing > XXX-swing.jar
echo nothing > XXX-tools.jar
echo nothing > XXX-ware.jar
echo nothing > XXX-wo.jar
del -Q C:\jboss-4.0.5\server\default\deploy\webstart.war\jars\XXX-*.*
move *.* C:\jboss-4.0.5\server\default\deploy\webstart.war\jars
cd ..
rmdir -Q jars-gui