I have been trying to detect if Tomcat is installed on a host system in my NSIS script.Here is the section that does it
Section Tomcat
ClearErrors
Var /GLOBAL tomcatVersion
ReadRegStr $tomcatVersion HKLM "SOFTWARE\Apache Software Foundation\Tomcat\7.0\Tomcat7" "InstallPath"
;ExecWait "$EXEDIR\apache-tomcat-7.0.22.exe"
DetailPrint "$tomcatVersion"
SectionEnd
When I go to “regedit” and check the path of that specific key, it has a value, but the print statement returns a blank.
Can someone suggest what is the best way to troubleshoot this and/or any errors that I might be facing?
There is an interesting thing I noticed, that If in the above code, if I point the ReadRegStr command to read
HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
It returns a value, so syntactically, the code does work.
If the Tomcat installer is a 64 bit installer then a 32 bit process will not find that key, in NSIS you can use
SetRegView 64.If you are using
RequestExectionLevelin your script and the Tomcat installer was virtualized by UAC then you must read it from the VirtualStore (Unlikely in your case since you can see the key in regedit)Process Monitor is also handy to debug registry issues…