java - How to set a variable in INSTALL4j during the installation to make it available in the .exe file after installation
问题描述
I made using install4j
IDE. During the installation, I want to be able to assign a variable and make it available for the .exe
file when the installation is complete.
Simplified scenario:
- A user provides his name in the form while running the installer.
- Installation process finished.
- A user executes the created
.exe
file - Application Greets the user with:
Hello {name provided in step 1.}
What is the best way to achieve that?
解决方案
All form components that take user input, for example the "Text field" form component bind the input to an installer variable that is automatically registered as a response file variable.
For example, if the configured variable is "myName", then in your launcher you can retrieve the entered value via
com.install4j.api.launcher.Variables.getInstallerVariable("myName")
For other installer variables that are not filled by form components, you can call
context.registerResponseFileVariable("otherVariable");
in a "Run script" action to make them available in the same way in your launchers.
推荐阅读
- java - 遇到 JSONreader ClassNotFoundException 尽管将它包含在类路径中
- python - 为什么python内存分配会这样?
- reactjs - 反应问题。如何动态更改 setInterval 中的间隔值
- angular - Angular:从资产文本文件中加载值
- python - 用于过滤更新值的熊猫数据框的自定义函数
- javascript - 从数组中删除所有不以 X 结尾的项目
- mysql - mariadb 不允许我添加外键
- c# - 如何在 Winform 中格式化 LostFocus 事件的所有文本框值
- c - 你知道如何让我的总结功能正常工作吗?因为它一直给我价值 0
- r - 关于 R 中的 stplanr 包的问题