Skip to content

Commit

Permalink
Find Adoptium while installer is running
Browse files Browse the repository at this point in the history
Closes qzind#938
  • Loading branch information
tresf committed Mar 23, 2022
1 parent 5a1a372 commit e12f577
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ant/windows/nsis/Include/FindJava.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Var /GLOBAL java_major
!define EXE "java.exe"

!define ADOPT "SOFTWARE\Classes\AdoptOpenJDK.jarfile\shell\open\command"
!define ECLIPSE "SOFTWARE\Classes\Eclipse Foundation.jarfile\shell\open\command"
!define ECLIPSE "SOFTWARE\Classes\Eclipse Adoptium.jarfile\shell\open\command"
!define ECLIPSE_OLD "SOFTWARE\Classes\Eclipse Foundation.jarfile\shell\open\command"

!define JRE "Software\JavaSoft\Java Runtime Environment"
!define JRE32 "Software\Wow6432Node\JavaSoft\Java Runtime Environment"
Expand All @@ -32,6 +33,15 @@ Var /GLOBAL java_major
IfFileExists "$0" Found
!macroend

!macro _ReadEclipseOldKey
ClearErrors
ReadRegStr $0 HKLM "${ECLIPSE_OLD}" ""
StrCpy $0 "$0" "" 1 ; Remove first double-quote
${IndexOf} $1 $0 "$\"" ; Find the index of second double-quote
StrCpy $0 "$0" $1 ; Get the string section up to the index
IfFileExists "$0" Found
!macroend

!macro _ReadAdoptKey
ClearErrors
ReadRegStr $0 HKLM "${ADOPT}" ""
Expand Down Expand Up @@ -91,6 +101,7 @@ Var /GLOBAL java_major

; Check registry
!insertmacro _ReadEclipseKey
!insertmacro _ReadEclipseOldKey
!insertmacro _ReadAdoptKey
!insertmacro _ReadReg "${JRE}"
!insertmacro _ReadReg "${JRE32}"
Expand Down

0 comments on commit e12f577

Please sign in to comment.