Install4j - 如何获取安装程序的版本?

Install4j - How to get version of Installer?

我想获取当前安装的版本,我试过:

String myVersion = (String)context.getVariable("sys.version");

但是我不知道如何得到context

在您自己的代码中(而不是在安装程序中),调用

com.install4j.api.launcher.Variables.getCompilerVariable("sys.version")

在安装程序中(当您有上下文时),它将是

context.getCompilerVariable("sys.version")