gpt4 book ai didi

java - 如何在卸载程序中使用安装程序变量?

转载 作者:行者123 更新时间:2023-11-30 08:12:06 25 4
gpt4 key购买 nike

这是我的用例,以便您理解我为什么需要卸载程序。我必须使用文件选择器修改在屏幕上选择的 WAR 文件的内容,首先用数据库备份它,然后修改数据库,然后修改 WAR。
WAR 和数据库的修改就像一个魅力,备份也是如此,但是我需要给最终用户一个可能性,就像他修改它们一样容易地恢复以前的 WAR 和数据库。

为此,我创建了一些将使用备份文件和安装程序运行时变量的操作,但我在执行卸载程序时显示错误,说它无法加载主类。

我只是不使用任何启动器,因为实际上我并没有尝试安装任何软件,只是进行一些文件操作。

所以我的问题是:

  1. 是否可以使用卸载恢复备份文件?
  2. 是否可以在其他应用程序中使用安装程序变量?

编辑:

在卸载程序中,我需要使用安装程序中的表单组件变量,以及我在安装程序中使用“设置变量”操作创建的其他变量,为此我必须选中“注册到响应文件”复选框。
然后在卸载程序的启动节点中,在“请求权限”操作之后,我添加了“加载响应文件”操作,并将"file"文本字段留空,以便加载安装程序创建的默认响应文件。
然后我在卸载程序的后续操作中调用这些变量 ${安装程序:变量名},就像你说的,但我收到一个错误对话框:

enter image description here

在生成的日志文件中使用此堆栈:

Exception:

com.install4j.api.beans.UndefinedVariableException: installer:zPath
at com.install4j.runtime.installer.InstallerVariables$InstallerReplacementCallback.handleError(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables$InstallerReplacementCallback.getReplacement(Unknown Source)
at com.install4j.runtime.util.StringUtil.replaceVariable(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables.replaceVariables(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables.replaceVariables(Unknown Source)
at com.install4j.api.beans.AbstractBean.replaceVariables(Unknown Source)
at com.install4j.runtime.beans.actions.files.AbstractFileAction.getFiles(Unknown Source)
at com.install4j.runtime.beans.actions.files.AbstractFileAction.execute(Unknown Source)
at com.install4j.runtime.beans.actions.SystemInstallOrUninstallAction.uninstall(Unknown Source)
at com.install4j.runtime.installer.UninstallerContextImpl$2.fetchValue(Unknown Source)
at com.install4j.runtime.installer.helper.comm.actions.FetchObjectAction.execute(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionWrapper(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.access$200(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication$1.run(Unknown Source)

我得到另一个变量的另外两个错误对话框,这是它的堆栈:

Exception:

com.install4j.api.beans.UndefinedVariableException: installer:zLoc
at com.install4j.runtime.installer.InstallerVariables$InstallerReplacementCallback.handleError(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables$InstallerReplacementCallback.getReplacement(Unknown Source)
at com.install4j.runtime.util.StringUtil.replaceVariable(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables.replaceVariables(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables.replaceVariables(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables.replaceVariables(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables.replaceVariables(Unknown Source)
at com.install4j.api.beans.AbstractBean.replaceVariables(Unknown Source)
at com.install4j.runtime.beans.actions.misc.RunExecutableAction.getExecutable(Unknown Source)
at com.install4j.runtime.beans.actions.misc.RunExecutableAction.execute(Unknown Source)
at com.install4j.runtime.beans.actions.SystemInstallOrUninstallAction.uninstall(Unknown Source)
at com.install4j.runtime.installer.UninstallerContextImpl$2.fetchValue(Unknown Source)
at com.install4j.runtime.installer.helper.comm.actions.FetchObjectAction.execute(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionWrapper(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.access$200(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication$1.run(Unknown Source)

Exception:

com.install4j.api.beans.UndefinedVariableException: installer:zLoc
at com.install4j.runtime.installer.InstallerVariables$InstallerReplacementCallback.handleError(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables$InstallerReplacementCallback.getReplacement(Unknown Source)
at com.install4j.runtime.util.StringUtil.replaceVariable(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables.replaceVariables(Unknown Source)
at com.install4j.runtime.installer.InstallerVariables.replaceVariables(Unknown Source)
at com.install4j.api.beans.AbstractBean.replaceVariables(Unknown Source)
at com.install4j.runtime.beans.actions.files.AbstractFileAction.getFiles(Unknown Source)
at com.install4j.runtime.beans.actions.files.AbstractFileAction.execute(Unknown Source)
at com.install4j.runtime.beans.actions.SystemInstallOrUninstallAction.uninstall(Unknown Source)
at com.install4j.runtime.installer.UninstallerContextImpl$2.fetchValue(Unknown Source)
at com.install4j.runtime.installer.helper.comm.actions.FetchObjectAction.execute(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionWrapper(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.access$200(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication$1.run(Unknown Source)

最佳答案

Is it possible to restore the backup files using the uninstallation?

这已在上面的评论中得到解决。

Is it possible to use installer variables in other applications?

是的,将“加载响应文件”操作添加到卸载程序的“启动”节点。该变量必须是响应文件变量。绑定(bind)到表单组件的所有变量都会自动注册到响应文件中。对于其他变量,当您在安装程序配置的“安装程序变量”选项卡上预定义安装程序变量时,会出现一个复选框。或者,您可以调用

context.registerResponseFileVariable(...);

在安装程序的“运行脚本”操作中。

然后在卸载程序中,您可以使用语法 ${installer:variableName} 在文本字段中使用这些响应文件变量,或者通过 context.getVariable("variableName")< 在脚本中使用这些变量.

关于java - 如何在卸载程序中使用安装程序变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30710161/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com