如何让IzPack检查现有版本的软件? [英] How to get IzPack tocheck for an existing version of the software?

查看:172
本文介绍了如何让IzPack检查现有版本的软件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我们使用 IzPack 创建安装程序。安装程序在其当前状态下正常工作,但是,我需要添加一些功能,以便检查是否安装了现有版本

I have an application for which we use IzPack to create the installer. The installer is working fine in its current state, however, I need to add functionality that enables it to check whether an existing version of the software has been installed.

我知道IzPack使用 CheckedHelloPanel ,不幸的是只适用于Windows,因为它似乎取决于Windows注册表。

I understand IzPack supports this out of the box using its CheckedHelloPanel, unfortunately that only works for Windows, as it appears to depend on the windows registry.

是否有一种方法来配置IzPack,以便能够检测现有安装

Is there a way to configure IzPack such that it is able to detect existing installations?

我需要能够检测是否是一个,只是显示一条消息通知用户...奖励点如何给用户触发现有安装的卸载程序的选项。

I need to be able to detect whether there is one and merely display a message notifying the user... Bonus points for how to give the user the option to trigger the uninstaller of the existing installation.


  • 假设软件只能使用新安装程序安装

  • 仅限IzPack:请不要提出替代方案,因为我们不能改变现在

  • 如果您建议使用 < validator> ,请包含验证器类的代码示例,因为我已经考虑过这一点,但不知道从哪里开始

  • Assume that the software will only be installed using the new installer
  • IzPack only: please do not suggest alternatives, as we cannot change that now
  • If you suggest using <validator>, please include a code sample of the validator class, because I have considered this, but don't know where to start

推荐答案

我写了这个来允许我的应用程序通过jboss安装。

I wrote this to allow my application to be installed over the jboss install.

public class JBossChecker {

 private static boolean tempJBossEnv;
 private static boolean tempJBossDirectoryExists;

 static {
  String s = System.getenv("JBOSS_HOME");
  tempJBossEnv= (s!=null);

  if( tempJBossEnv) {
   File f = new File(s);
   tempJBossDirectoryExists= ( f.exists() && f.isDirectory());
  }
  hasJBossEnv =tempJBossEnv;
  hasJBossDir = tempJBossDirectoryExists;
 }

 public static boolean hasJBossDir;
 public static boolean hasJBossEnv;

 public static void main(String[] args){
  System.out.println("Jboss environment "+hasJBossEnv);
  System.out.println("Jboss directory "+hasJBossDir);

 }
}

<conditions>
     <condition type="java" id="jbossEnv">
             <java> 
                 <class>au.com.codarra.ela.installer.JBossChecker</class
                 <field>hasJBossEnv</field>
             </java>
             <returnvalue type="boolean">true</returnvalue>
 </condition> 

 <condition type="java" id="jbossDir">
             <java>
                 <class>au.com.codarra.ela.installer.JBossChecker</class>
                 <field>hasJBossDir</field>
             </java>
             <returnvalue type="boolean">true</returnvalue>
 </condition> 

</conditions>

<installerrequirements>
 <installerrequirement condition="jbossEnv" message="Your system does not have the environment variable JBOSS_HOME set. Cannot update your system. Is XXXX installed on this system?" />
 <installerrequirement condition="jbossDir" message="Your system does not have a directory at the location in the environement variable JBOSS_HOME . Cannot update your system. Is XXXX installed on this system?" />
</installerrequirements>

<dynamicvariables>
 <variable name="INSTALL_PATH" value="${ENV[JBOSS_HOME]}"/>
</dynamicvariables>





<jar src="c:\dev\xxxx\build\installer.jar" />

最后的位确保izpack将它添加到安装程序jar。

The bit at the end makes sure izpack adds it to the installer jar.

这篇关于如何让IzPack检查现有版本的软件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆