Archive: How Install JDK if not Exist


How Install JDK if not Exist
Hai,

i am newbies in NSIS Installer,

I would like to check a JDK. If JDK not exist => install it.
And if JDK exist do not install it.

How to make that happen. Because in my test code always install it i try to check Registry and use "IfErrors" function but i cannot do it

This is my test code :

Section "JDK"
ClearErrors
ReadRegStr $0 HKLM "Software\JavaSoft\Java Development Kit\1.4.2_06" JavaHome
IfErrors Install_JDK

Install_JDK:
ExecWait ${Installer_JDK} ; run if never have a JDK

SectionEnd


You need to jump over it if it's not installed:

Section "JDK"

ClearErrors
ReadRegStr $0 HKLM "Software\JavaSoft\Java Development Kit\1.4.2_06" JavaHome
IfErrors 0 +2
ExecWait ${Installer_JDK} ; run if never have a JDK

SectionEnd

-Stu


Thanks,

now my installer run like i want :)

Btw what the meaning ifErrors 0 +2. I look on helpfile still i
can not clear about that. Can you explain to me ?

Andy


IfErrors jumpto_iferror [jumpto_ifnoerror]
IfErrors 0 +2

0 means carry onto the next instruction (same as +1)
+2 means jump over the next instruction onto the one after it
These are relative jumps as opposed to a label jump which you used.

-Stu


Thanks for you explain. i am enlight now