Archive: How to know JSDK home directory.


How to know JSDK home directory.
  Hi everybody!
I am using NSIS 2.0b1. I want to know JSDK home directory and check whether its version is later than 1.4 or not . Please help me.


Read this: HKLM\SOFTWARE\JavaSoft\Java Runtime Environment "CurrentVersion" -> $0 and use that to read: HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\$0 "JavaHome" or is that not what you are looking for?

I actually do not know what belongs to the JavaScript Development Kit (assuming that is the meaning of JSDK), so these regentries might not be helping or maybe they are...

-Hendri.


Hi,
this is what I've used

ClearErrors

ReadRegStr$1 HKLM "SOFTWARE\\JavaSoft\\Java Development Kit" "CurrentVersion"
>ReadRegStr $2 HKLM "SOFTWARE\\JavaSoft\\Java Development Kit\$1" "JavaHome"

>IfErrors 0 NoAbort
MessageBox MB_OK "Couldn't find a Java Development Kit installed. Setup will exit now."
Quit

NoAbort:
DetailPrint "Found JDK in path $2"
it uses $1 and $2 so you might consider push and pop them to be safe.
$1 contains the version and $2 the path.


Hope this helps,
Chris

So I was close :) Java uses the same structure in the registry as JDK :)

Have fun,
-Hendri.


Yes, and BTW JSDK stands for Java Software Development Kit ;)

Regards,
Chris


Of course :)

I am really not into Java, but my posts have already proven that :D

Greetz,
-Hendri.


pcristip, can you please add this to the archive so others can enjoy it too?

TIA,
KiCHiK


Sure, I'll do it right now.


Thanks for your help ,especially pcristip and Smile2Me!
I thought about your way and I used it. My problem is that when $1 is a string version. I cannot compare it to 1.4 to decide that whether it is greater than 1.4 or not by NSIS script. I feel a shame to get your help again
Thanks!


The problem is known, and that is why I created this script in the past.

And thanks for the nice words :)

Have fun with the script, greetz,
-Hendri.


Thanks Smile2Me very much, indeed!
My topic can stop here!
Huu Phuoc


Good function, I'll have to watch the archive more :D
I made my own especially for java something like this:

    StrCpy$3 $1 1 ; major version

StrCpy$4 $1 1 2 ; minor version
IntFmt$5 "%u" $3
IntFmt$6 "%u" $4
IntCmp$6 4 0 otherwise

greater_than_1_4:
MessageBox MB_OK "JDK>=1.4"
>otherwise:
but I guess yours is more general

Cheers,
Chris

Chris, looks nice, but be warned, it only works with structures as a.b where a and b two numbers. If we would get something like 1.19 or 11.9, it would not work anymore. That is why I created the script :)

But thanks for the contribution!

Greetz,
-Hendri.