Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在java脚本中检查regsity值的值_Java_Install4j - Fatal编程技术网

在java脚本中检查regsity值的值

在java脚本中检查regsity值的值,java,install4j,Java,Install4j,我的安装程序中有一个脚本,正在检查注册表项是否存在 Util.showWarningMessage("Here"); Integer xx = (Integer)WinRegistry.getValue(RegistryRoot.HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\VC\\Runtimes\\x86", "Installed"); Util.showWarningMessage(

我的安装程序中有一个脚本,正在检查注册表项是否存在

Util.showWarningMessage("Here");

Integer xx = (Integer)WinRegistry.getValue(RegistryRoot.HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\VC\\Runtimes\\x86", "Installed");

Util.showWarningMessage("Here 2");

if (xx == 1) {
    Util.showWarningMessage("return 1");
}
else{
     Util.showWarningMessage("here 1");
}

return true;
脚本可以编译,但是当我运行安装程序时,我会看到前两条警告消息,而不是if语句中的警告消息。脚本似乎也在返回false。这是一个条件语句,用于查看是否安装了某个组件。 当我删除if语句时,最终返回值达到了预期值

如果有人能解释出问题所在,我将不胜感激


提前感谢

可能xx为空,取消装箱会引发异常。试试这个:

Util.showWarningMessage("xx = " + xx);

检查xx的值。

这是Java,不是Javascript