我试图检查Java 8是否在注册表中或Java 9-11是否在注册表中,所以我编写了此脚本:
[Code]
{ Script to check if a JRE is installed, it will search for the old java 8 location and for the new java 11 location }
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
JavaVer: string;
begin
{ checking for old java 8 location }
RegQueryStringValue(
HKLM64, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
ResultOldJava := (Length(JavaVer) > 0);
{ checking for new java 9-11 location }
RegQueryStringValue(
HKLM64, 'SOFTWARE\JavaSoft\JDK', 'CurrentVersion', JavaVer);
ResultNewJava := (Length(JavaVer) > 0);
if not ResultOldJava and not ResultNewJava then
begin
if MsgBox('ATENCIÓN: Gestor requiere Java 64 Bits instalado en el sistema. No se ha encontrado, ¿Desea abrir la página de descargas oficial? Por favor, recuerde que es necesaria la versión de 64 bits.', mbConfirmation, MB_YESNO) = idYes then
begin
ShellExec(
'open', 'https://www.java.com/es/download/manual.jsp#win',
'', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
end;
end;
问题在于它正在打印此错误:
Unknown Identifier 'ResultOldJava'
怎么了?我在帕斯卡的技能很低
答案 0 :(得分:2)
您已经声明了ResultOldJava
变量,就像已经声明了ErrorCode
和JavaVer
一样:
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
JavaVer: string;
ResultOldJava: Boolean;
begin