install4j可以检测其他install4j安装吗? [英] Can install4j detect other install4j installations?

查看:83
本文介绍了install4j可以检测其他install4j安装吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景信息...我维护产品"A"的install4j项目.我们正在开发新产品"B",并且产品管理要求它具有自己的基于install4j的安装程序.

Backgound info... I maintain an install4j project for product "A". We are in the process of developing a new product, "B", and product management has mandated that it have its own install4j-based installer.

可能值得注意的是,这两种产品之间没有文件系统重叠或共享库.也就是说,它们将被安装到同一系统上的唯一目录(例如/opt/myCompany/prodA/opt/myCompany/ProdB).

It might be worth noting that there is no fileystem overlap or shared libraries between these two products. That is, they will be installed to unique directories on the same system (e.g. /opt/myCompany/prodA, /opt/myCompany/ProdB).

但是,产品"B"要求将产品"A"安装在同一系统上.但是产品"A"不依赖于"B".因此,产品"B"的安装程序将需要能够权威地确定产品"A"是否已安装在同一台计算机上;如果没有,则进行安装.

However, product "B" requires that product "A" be installed on the same system. But product "A" is not dependent on "B". So the installer for product "B" will need to be able to authoritatively determine if product "A" is already installed on the same machine, and if not, then install it.

问题:install4j是否维护某种永久性的产品安装注册表,以便产品"B"的安装程序可以权威地确定其从属产品("A")是否已安装在系统上?甚至甚至可以查询安装/产品详细信息(例如版本,安装目录)?

Questions: Does install4j maintain some kind of persistent registry of products that it installs, so that the installer for product "B" can authoritatively determine if its dependent product ("A") is already installed on the system? And perhaps even query for installation/product details (e.g. version, install directory)?

如果没有,我总是可以添加一些脚本逻辑来搜索产品"A"的明显标志(例如,查找名为"A"的Windows服务),或者让用户浏览产品A的安装目录,但是我会如果install4j为此提供了帮助,则至少希望至少尝试一种更好的/内置的方式来完成此任务?

If not, I can always add some scripting logic to search for telltale signs of product "A" (e.g. look for the Windows Service named "A"), or have the user browse to product A's installation directory, but I would prefer to at least try a better/built-in way to accomplish this task, if install4j provides for this?

最后,还有一点要说的是,如果系统上尚未安装产品"A",那么我计划使用运行可执行文件或批处理文件"操作从介质进行安装.我提到这一希望是为了肯定这是解决此问题的正确方法.

Finally, and somewhat as an aside, if product "A" is not already installed on the System, then I plan to use the "Run executable or batch file" action to install it from media. I mention this hoping for an affirmation that this is the correct approach to this problem.

感谢所有帮助!

推荐答案

install4j通过ApplicationRegistry类在API中公开了此类功能:

install4j exposes such functionality in the API with the ApplicationRegistry class:

http://resources.ej- technologies.com/install4j/help/api/com/install4j/api/ApplicationRegistry.html

使用此类的代码段是:

ApplicationRegistry.ApplicationInfo[] applicationInfos =
    ApplicationRegistry.getApplicationInfoById("other app ID");

if (applicationInfos.length > 0) {
    context.setVariable("otherAppInstalled", applicationInfos.length > 0);
    context.setVariable("otherAppInstallationDir", 
        applicationInfos[0].getInstallationDirectory().getPath());
}

这篇关于install4j可以检测其他install4j安装吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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