Detecting the JDK version: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Added category links.)
m (Adding new author and category links.)
Line 1: Line 1:
{|align=right
{{PageAuthor|pcristip}}
|<small>Author: [[{{ns:2}}:pcristip|pcristip]] ([[{{ns:3}}:pcristip|talk]], [[{{ns:-1}}:Contributions/pcristip|contrib]])</small>
 
|}
<br style="clear:both;">
== Description ==
== Description ==
The following code snippet detects whether Java Development Kit is installed on the machine and will set $1 to the version and $2 to the directory of the installation.
The following code snippet detects whether Java Development Kit is installed on the machine and will set $1 to the version and $2 to the directory of the installation.
Line 19: Line 17:
</highlight-nsis>
</highlight-nsis>


[[{{ns:14}}:Other Products Version Detection Functions]]
[[Category:Other Products Version Detection Functions]]

Revision as of 12:07, 24 June 2005

Author: pcristip (talk, contrib)


Description

The following code snippet detects whether Java Development Kit is installed on the machine and will set $1 to the version and $2 to the directory of the installation.

The Snippet

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"