如何在install4j中使用setVariable

how to use setVariable in install4j

我在 install4J 的启动序列中有以下代码

Util.showMessage("before set sys.contentDir " + (String)context.getVariable("sys.contentDir"));

context.setVariable("sys.contentDir", "E:\testApp");

Util.showMessage("After set sys.contentDir " + (String)context.getVariable("sys.contentDir"));

但是在使用 setVariable 方法设置 sys.contentDir 后,新值没有反映出来。

请帮助实现功能。

问候,
Jagadeesh Musham.

sys.contentDir是系统变量,不能修改。要更改安装目录,请使用

context.setInstallationDirectory(new File("E:\testApp"));