- Java运行环境(OpenJDK 1.7 JRE) - 一个脚本(.bat) - 一个fat JAR - 一个图标文件 - 几个文本文件
我不想使用系统的JRE,这就是为什么我提供另一个JRE的原因。脚本只是调用带有一些参数的JRE。图标文件以.ico格式存在。fat JAR是包含所有必要的Java类、本地库和资源(包括第三方库)的JAR。
我希望允许最终用户安装、运行和卸载我的程序。我想提供一个开始菜单中的快捷方式来运行它,另一个用于卸载它。这似乎在这里有解释。我是否需要使用其他东西来创建卸载程序的快捷方式?
我已经查看了Wix Toolset几个星期。我知道我必须编写一个wxs文件与"candle.exe"一起使用,它会创建一个wixobj文件,我必须使用此文件运行"light.exe",然后我会得到一个MSI文件。
我知道如何添加一个文件,这里有解释,但我不知道如何添加包含JRE的整个目录,而不是逐个列出每个文件。如何在wxs文件中完成?
如何选择一些唯一的GUID?
是否已经有一个更简单的工具可以用来从fat JAR制作MSI文件?在尝试使用Apache POI在GNU Linux下进行编程之前,我更喜欢先了解如何在Windows命令行中构建此类文件。
编辑:这是我的第一个wxs文件:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Truly Unusual Experience of Revolution" Language="1033" Version="0.0.0.0" Manufacturer="Julien Gouesse" UpgradeCode="00000000-0000-0000-0000-000000000000">
<!-- Installer's Icon in Add/Remove Programs -->
<Icon Id="icon.ico" SourceFile="tuerLogo.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<!-- Installer's version = 200 because the 64-bit support is required -->
<Package InstallerVersion="200" InstallPrivileges="elevated" InstallScope="perMachine" Compressed="yes" Platform="x64" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<MajorUpgrade AllowDowngrades="yes" IgnoreRemoveFailure="yes" Schedule="afterInstallInitialize" />
<Condition Message="This application is only supported on Windows XP, Windows Vista, Windows Server 2008, or higher.">
<![CDATA[Installed OR (VersionNT >= 501)]]>
</Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="Truly Unusual Experience of Revolution">
<Component Id="tuer.bat" Guid="00000000-0000-0000-0000-000000000000">
<File Id="tuer.bat" Source="tuer.bat" KeyPath="yes"/>
</Component>
<Component Id="tuer.jar" Guid="00000000-0000-0000-0000-000000000000">
<File Id="tuer.jar" Source="tuer.jar" KeyPath="yes"/>
</Component>
<Component Id="LICENSE.txt" Guid="00000000-0000-0000-0000-000000000000">
<File Id="LICENSE.txt" Source="LICENSE.txt" KeyPath="yes"/>
</Component>
<Component Id="NOTICE.txt" Guid="00000000-0000-0000-0000-000000000000">
<File Id="NOTICE.txt" Source="NOTICE.txt" KeyPath="yes"/>
</Component>
<Component Id="README.txt" Guid="00000000-0000-0000-0000-000000000000">
<File Id="README.txt" Source="README.txt" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Truly Unusual Experience of Revolution"/>
</Directory>
</Directory>
<!-- Shortcut in the Start Menu -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="00000000-0000-0000-0000-000000000000">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="Truly Unusual Experience of Revolution"
Description="First person shooter"
Target="[#tuer.bat]"
WorkingDirectory="APPLICATIONROOTDIRECTORY"
Icon="icon.ico" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\TrulyUnusualExperienceofRevolution" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id="TrulyUnusualExperienceofRevolution" Title="Truly Unusual Experience of Revolution" Level="1">
<ComponentRef Id="tuer.bat" />
<ComponentRef Id="tuer.jar" />
<ComponentRef Id="LICENSE.txt" />
<ComponentRef Id="NOTICE.txt" />
<ComponentRef Id="README.txt" />
<ComponentRef Id="ApplicationShortcut" />
</Feature>
</Product>
</Wix>
注意: 我不回答自己的问题,但当我发现使用NSIS(Nullsoft Scriptable Install System)构建安装程序会更容易时,我停止了调查,因为已经有一个Ant任务和一些软件包适用于多个GNU Linux发行版(包括Mageia, Fedora, ...),以使其正常工作。您可以找到一个名为Java Launcher的脚本来寻找您的软件和操作系统中的JRE(即使我建议您将OpenJDK JRE捆绑在您的软件中,以确保它将继续工作,尽管更新或操作系统中没有JRE),另一个带有自动JRE安装的脚本和一个基于Java的软件的nsi脚本的简单示例。
顺便提一下,我现在使用自己的工具(它在底层使用Redline RPM),它完全文档化、开源(根据GPL),并且适用于RPM、DEB、APP和EXE(通过NSIS),它被称为Java Native Deployment Toolkit。