当项目在Java中使用许多其他依赖项时,如何创建安装程序?

时间:2011-12-25 15:16:38

标签: java windows deployment installer packagemaker

我的主要应用程序是用Java编写的,它有Main.jar。我正在准备最终的部署包。

但它还有其他依赖项,例如第三方库需要首先在Windows操作系统中可用/预安装,一旦安装了我的应用程序就可以运行,否则它将显示错误并且无法正常工作。所以我很挣扎,最终用户必须这样做:

1) Thirdparty.library.msi (install manually) which is a GUI installer itself already
2) Then setup my Main.jar
3) Once it started it looks first for the third party libraries, if does not exist, software fails.

对于这种情况,是否有任何正确的方法可以使一个安装程序能够完成第1步和第2步的工作,但两者看起来都像是安装?

跟进:我还希望最终用户看不到我的第三方用于演示目的。所以我看到有一个名为msi的工具

1)安装程序准备BATCH

Windows ® Installer. V 3.01.4000.1823 

msiexec /Option <Required Parameter> [Optional Parameter]

Install Options
    </package | /i> <Product.msi>
        Installs or configures a product
    /a <Product.msi>
        Administrative install - Installs a product on the network
    /j<u|m> <Product.msi> [/t <Transform List>] [/g <Language ID>]
        Advertises a product - m to all users, u to current user
    </uninstall | /x> <Product.msi | ProductCode>
        Uninstalls the product
Display Options
    /quiet
        Quiet mode, no user interaction
    /passive
        Unattended mode - progress bar only
    /q[n|b|r|f]
        Sets user interface level
        n - No UI
        b - Basic UI
        r - Reduced UI
        f - Full UI (default)
    /help
        Help information
Restart Options
    /norestart
        Do not restart after the installation is complete
    /promptrestart
        Prompts the user for restart if necessary
    /forcerestart
        Always restart the computer after installation
Logging Options
    /l[i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] <LogFile>
        i - Status messages
        w - Nonfatal warnings
        e - All error messages
        a - Start up of actions
        r - Action-specific records
        u - User requests
        c - Initial UI parameters
        m - Out-of-memory or fatal exit information
        o - Out-of-disk-space messages
        p - Terminal properties
        v - Verbose output
        x - Extra debugging information
        + - Append to existing log file
        ! - Flush each line to the log
        * - Log all information, except for v and x options
    /log <LogFile>
        Equivalent of /l* <LogFile>
Update Options
    /update <Update1.msp>[;Update2.msp]
        Applies update(s)
    /uninstall <PatchCodeGuid>[;Update2.msp] /package <Product.msi | ProductCode>
        Remove update(s) for a product
Repair Options
    /f[p|e|c|m|s|o|d|a|u|v] <Product.msi | ProductCode>
        Repairs a product
        p - only if file is missing
        o - if file is missing or an older version is installed (default)
        e - if file is missing or an equal or older version is installed
        d - if file is missing or a different version is installed
        c - if file is missing or checksum does not match the calculated value
        a - forces all files to be reinstalled
        u - all required user-specific registry entries (default)
        m - all required computer-specific registry entries (default)
        s - all existing shortcuts (default)
        v - runs from source and recaches local package
Setting Public Properties
    [PROPERTY=PropertyValue]

OR     enter image description here

2)实用/样本

# Install Silently [works]:
C:\windows\system32\msiexec.exe /I "C:\Documents and Settings\sun\My Documents\Downloads\10.70.msi" /QN
C:\windows\system32\msiexec.exe /I "C:\Documents and Settings\sun\My Documents\Downloads\10.71.msi" /QN

# For future reference [not tested]
start /wait msiexec /i O12Conv.msi /qb
start /wait msiexec /p O12Convsp1-en-us.msp /qb
start /wait msiexec /i mpsetupedp.msi

# other samples [not tested]
msiexec /package Application.msi /quiet
msiexec /uninstall Application.msi /quiet
msiexec /update msipatch.msp /quiet
msiexec /uninstall msipatch.msp /package Application.msi / quiet

3 个答案:

答案 0 :(得分:2)

所有基于UI的安装工具都能够运行外部程序并以批处理模式运行,该模式由命令行参数控制。

所以,如果你的第三方.msi是你所拥有的并且必须使用我建议你找到以批处理模式运行它的能力。然后创建自己的安装过程,该过程将调用此第三方MSI。

有各种工具可用于创建基于UI的安装程序(InstallShieled,InstallAnywhere等)。

答案 1 :(得分:1)

如何创建DOS批处理脚本(.bat)并从那里以特定顺序调用msi安装程序和JAR?

答案 2 :(得分:1)

有一种方法可以检查是否安装了相关应用程序[就像设置的env变量一样]。如果没有,则打包脚本可以安装它。我在Install Shield中做过这个;不确定其他工具。