为了安装我的Windows桌面应用程序,我使用izpack创建一个安装程序,然后使用winrun4j从exe中调用它,也是izpack安装的一部分,添加另一个winrun4j包装器,以便在安装后实际运行该应用程序。
麻烦的是,要使win4runj.exe正常工作,它需要使用正确的Java类型,即如果exe为64位,则必须运行64位jvm,如果exe为32位,则必须运行32位jvm。这可能会让用户感到困惑,所以我将利用winrun4j来使用嵌入式jvm,然后进行两次下载
但我的困惑是,对于每次下载我只想嵌入jvm一次,但无法解决如何做到这一点因为我有两个exes(安装程序和程序本身),这可以做到吗?
更新
如果我安装JVM两次(在使用izpack构建时一旦包含在install.jar中,并且一旦添加到zip文件中,那么可以由widgetinstaller.exe使用)。
<file src="C:/code/widget/JVM32bit" targetdir="$INSTALL_PATH"/>
但我只想要一次JVM,我知道我需要从izpack.xml中删除<file src="C:/code/widget/JVM32bit" targetdir="$INSTALL_PATH"/>
,但是如何将我的32bitJVM复制到程序安装文件夹中
需要将相同的JVM保存到程序文件夹中。
似乎这必须在izpack本身之外完成吗?
修改
解决方案是使用Can I install a file using Izpack 5 without it being part of the install.jar built by izpack
中描述的Izpack松散包但是必须为路径设置的内容非常混乱,文档错误地暗示您放入了相对链接http://izpack.org/documentation/installation-files.html#the-packs-element-packs。
示例
izpack install.xml位于C:\ code \ Widget \ installer
<pack name="Base" loose="true" required="yes" preselected="yes">
<description>JVM</description>
<file src="C:\Code\Widget\JVM" targetdir="$INSTALL_PATH"/>
</pack>
当打包izpack时应该有:
JVM
install.jar
setup.exe
答案 0 :(得分:0)
如果JVM嵌入在安装程序中,则程序无法使用它。 如果JVM嵌入在程序中,那么安装程序也无法使用它。
但是,您仍然可以只使用一个JVM。这是通过将JVM复制到本地文件来完成的。
因此,当您使用winrun4j启动安装程序时,它将从嵌入式JVM启动,然后在安装结束时,需要将相同的JVM保存到程序文件夹中。
您的程序winrun4j exe然后可以使用您保存到该文件夹的JVM来启动程序,您可以通过将winrun4j中的“vm.location”设置为已保存JVM的位置来执行此操作。
Process:
1) Run the installer exe with the required JVM
2) During the installation save the embedded JVM to a file
3) Once the instillation is complete the program exe can launch using the saved JVM