Old 8th April 2015, 22:27   #1
cstokes
Junior Member
 
Join Date: Apr 2015
Posts: 1
Trouble checking JRE in installer

I've made an installer that makes use of the JRE checking script available here:
http://nsis.sourceforge.net/New_inst...ing_jre.ini%29

When I use this script, my installer produces the error "No Java Runtime Environment could be found on your computer" even though I have Java 1.8 installed. If I understand the logic of this script correctly, this should occur if my Java registry keys aren't set.

I've checked my registry keys, and the following are set:

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment: CurrentVersion = 1.8
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8: JavaHome = C:\Program Files\Java\jre1.8.0_40

I don't understand why I'm seeing the "No Java Runtime Environment" error - does anyone have any insight?
cstokes is offline   Reply With Quote
Old 9th April 2015, 00:10   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,190
64-bit version of Windows?

64-bit version of Java (does that even exist)?

Are you using SetRegView in your script?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th April 2015, 08:14   #3
Theresias
Junior Member
 
Join Date: Jun 2006
Posts: 48
I ran into the same issue but didn't have time to actually check what caused it, instead a simple workaround did the trick for now...


code:
!define JAVA_JRE_REGPATH "SOFTWARE\JavaSoft\Java Runtime Environment"
!define JAVA_JRE_REGPATH2 "SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment"
!define JAVA_JDK_REGPATH "SOFTWARE\JavaSoft\Java Development Kit"
!define JAVA_JDK_REGPATH2 "SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit"
!define JAVA_DOWNLOAD_URL "http://www.java.com/download"





code:
# Java Version/Installation Check
SetRegView 32 # Make sure we're checking x86 Registry
!ifdef DEBUG
StrCpy $RegPlatform "x86"
!endif
ReadRegStr $R0 HKLM "${JAVA_JRE_REGPATH}" "CurrentVersion"
IfErrors 0 JavaCheckDone
ReadRegStr $R0 HKLM "${JAVA_JDK_REGPATH}" "CurrentVersion"
IfErrors 0 JavaCheckDone
ReadRegStr $R0 HKLM "${JAVA_JRE_REGPATH2}" "CurrentVersion"
IfErrors 0 JavaCheckDone
ReadRegStr $R0 HKLM "${JAVA_JDK_REGPATH2}" "CurrentVersion"
IfErrors 0 JavaCheckDone

SetRegView 64 # Make sure we're checking x64 Registry
!ifdef DEBUG
StrCpy $RegPlatform "x64"
!endif
ReadRegStr $R0 HKLM "${JAVA_JRE_REGPATH}" "CurrentVersion"
IfErrors 0 JavaCheckDone
ReadRegStr $R0 HKLM "${JAVA_JDK_REGPATH}" "CurrentVersion"
# IfErrors 0 JavaCheckDone
# ReadRegStr $R0 HKLM "${JAVA_JRE_REGPATH2}" "CurrentVersion"
# IfErrors 0 JavaCheckDone
# ReadRegStr $R0 HKLM "${JAVA_JDK_REGPATH2}" "CurrentVersion"

JavaCheckDone:
!ifdef DEBUG
MessageBox MB_OK|MB_ICONINFORMATION "Java Version Detected: $R0 $RegPlatform"
!endif

IntCmp $R0 ${PRODUCT_MINJAVAVERSION} +3 0 +3
MessageBox MB_YESNO|MB_ICONQUESTION "${MSG_NOJAVA}" /SD IDNO IDNO +2
ExecShell "open" "${JAVA_DOWNLOAD_URL}"
SetRegView 32 # Make sure we're back to the x86 Registry

Theresias is offline   Reply With Quote
Old 9th April 2015, 12:34   #4
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
This used to work fine:
http://forums.winamp.com/showpost.ph...60&postcount=4

PostEnd:
aerDNA is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump