在带有多平台项目的 install4j 中,如何根据平台更改 -Xmx 设置?

In install4j with a multi-platform project, how do I change the -Xmx setting based on platform?

我们在 OS X 上捆绑了一个 64 位 JRE,因为这就是 OS X 的全部内容。

我们在 Windows 上捆绑了 32 位 JRE,以确保使用 32 位 Windows 的人们可以安装我们的软件。

因此,我们要设置的最大堆大小因平台而异。对于OSX,默认就好了。在 Windows,我们想将其设置为 -Xmx512m。

我认为在 install4j 中设置 -Xmx 设置的正确位置是 Launchers -> Java Invocation -> 虚拟机参数。但是我不知道如何将它添加到 VM 参数文本字段 if and only if OS == Windows。我该怎么做?

您可以使用编译器变量执行此操作。

在 "General Settings->Compiler Variables" 步骤中,添加一个名为 "xmxParam" 的变量和一个空值。

在启动器向导中,添加

${compiler:xmxParam}

到 VM 参数文本字段。

然后您可以覆盖每个媒体文件的默认值。在 Windows 媒体文件的媒体向导中,转到 "Customize project defaults->Compiler variables" 步骤并用“-Xmx512m”覆盖 "xmxParam"。