我知道有一个bug on this subject,但是当安装程序在Linux环境中运行时(在Windows上工作正常),我似乎仍然会收到此错误。 我正在使用v6.1.6 [build:6459]
我试图做的事情:
Set a variable
操作,如果存在,我将获取 $ JAVA_HOME 路径,并将其设置为linuxJavaHome
变量。Run executable or batch file
动作,我使用安装程序之前的linuxJavaHome
变量获取了java版本。我在多个Linux环境中检查了我的代码,并且使用java主路径定义了变量。此外,我也尝试调试我的代码以确保它看起来没问题。
我唯一的问题是当我使用静音模式(-q)从JENKINS构建和运行我们的安装程序时,我总是得到这个 UndefinedVariableException 。我改进了问题点,它发生在第一个Set a variable
屏幕上。
异常堆栈跟踪是:
com.install4j.api.beans.UndefinedVariableException: installer:linuxJavaHome
13:03:08 Error log: /home/administrator/installer/install4jError2195873440024941405.log
13:03:08 com.install4j.api.beans.UndefinedVariableException: installer:linuxJavaHome
13:03:08 at com.install4j.runtime.installer.InstallerVariables$InstallerReplacementCallback.handleError(InstallerVariables.java:971)
13:03:08 at com.install4j.runtime.installer.InstallerVariables$InstallerReplacementCallback.getReplacement(InstallerVariables.java:950)
13:03:08 at com.install4j.runtime.util.StringUtil.replaceVariable(StringUtil.java:68)
13:03:08 at com.install4j.runtime.installer.InstallerVariables.replaceVariables(InstallerVariables.java:337)
13:03:08 at com.install4j.runtime.installer.InstallerVariables.replaceVariables(InstallerVariables.java:326)
13:03:08 at com.install4j.runtime.installer.InstallerVariables.replaceVariables(InstallerVariables.java:322)
13:03:08 at com.install4j.runtime.installer.InstallerVariables.replaceVariables(InstallerVariables.java:362)
13:03:08 at com.install4j.api.beans.AbstractBean.replaceVariables(AbstractBean.java:89)
13:03:08 at com.install4j.runtime.beans.actions.misc.RunExecutableAction.getExecutable(RunExecutableAction.java:58)
13:03:08 at com.install4j.runtime.beans.actions.misc.RunExecutableAction.execute(RunExecutableAction.java:292)
13:03:08 at com.install4j.runtime.beans.actions.SystemInstallOrUninstallAction.install(SystemInstallOrUninstallAction.java:29)
13:03:08 at com.install4j.runtime.installer.ContextImpl$7.executeAction(ContextImpl.java:1668)
13:03:08 at com.install4j.runtime.installer.ContextImpl$7.fetchValue(ContextImpl.java:1659)
13:03:08 at com.install4j.runtime.installer.ContextImpl$7.fetchValue(ContextImpl.java:1656)
13:03:08 at com.install4j.runtime.installer.helper.comm.actions.FetchObjectAction.execute(FetchObjectAction.java:14)
13:03:08 at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionDirect(HelperCommunication.java:274)
13:03:08 at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionInt(HelperCommunication.java:259)
13:03:08 at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionChecked(HelperCommunication.java:187)
13:03:08 at com.install4j.runtime.installer.helper.comm.HelperCommunication.fetchObjectChecked(HelperCommunication.java:170)
13:03:08 at com.install4j.runtime.installer.ContextImpl.performActionIntStatic(ContextImpl.java:1656)
13:03:08 at com.install4j.runtime.installer.InstallerContextImpl.performActionInt(InstallerContextImpl.java:151)
13:03:08 at com.install4j.runtime.installer.ContextImpl.performAction(ContextImpl.java:1103)
13:03:08 at com.install4j.runtime.installer.controller.Controller.executeAction(Controller.java:368)
13:03:08 at com.install4j.runtime.installer.controller.Controller.executeActions(Controller.java:334)
13:03:08 at com.install4j.runtime.installer.controller.Controller.executeActionGroup(Controller.java:405)
13:03:08 at com.install4j.runtime.installer.controller.Controller.executeActions(Controller.java:339)
13:03:08 at com.install4j.runtime.installer.controller.Controller.executeActionGroup(Controller.java:405)
13:03:08 at com.install4j.runtime.installer.controller.Controller.executeActions(Controller.java:339)
13:03:08 at com.install4j.runtime.installer.controller.Controller.handleCommand(Controller.java:195)
13:03:08 at com.install4j.runtime.installer.controller.Controller.handleStartup(Controller.java:116)
13:03:08 at com.install4j.runtime.installer.controller.Controller.start(Controller.java:73)
13:03:08 at com.install4j.runtime.installer.Installer.runInProcess(Installer.java:59)
13:03:08 at com.install4j.runtime.installer.Installer.main(Installer.java:46)
13:03:08 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:03:08 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
13:03:08 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:03:08 at java.lang.reflect.Method.invoke(Method.java:498)
13:03:08 at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:65)
13:03:08 at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:57)
答案 0 :(得分:2)
最后,对我有用的是忽略了使用$ JAVA_HOME变量并使用安装程序内部变量${installer:sys.javaHome}
,它在Linux和Linux上都很有用。视窗。
答案 1 :(得分:0)
"设置变量" action可能设置null变量值,因为未定义环境变量JAVA_HOME
。您可以选择"如果值为空则失败"该行动的财产,以便早些发现这个问题。