|
|
|
|
#1 |
|
Junior Member
Join Date: Oct 2010
Posts: 10
|
My NSIS check for JRE is broken
It is probably my code that is broken, but why does this code try to install the jre? I verified that C:\Windows\System32\java.exe does in fact exist, but this code doesn't see it. The method is lifted from http://forums.winamp.com/showthread.php?postid=1955725.
code: |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Nov 2005
Posts: 115
|
Are you running the installer on 64-bit Windows? If so $SYSDIR would actually be C:\Windows\SysWOW64, and maybe the 32-bit Java isn't installed but the 64-bit one is in C:\Windows\System32.
|
|
|
|
|
|
#3 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
and as you're using the RunningX64 LogicLib extension you probably included x64.nsh which allows you to turn off the redirection that happens when a 32bit app accesses $SYSDIR.
Note that if you're targeting only Vista+, you can alternatively access $WINDIR\SysNative\ (not available on XP unless the user installed an optional (not distributed through Windows Updates) hotfix). |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Oct 2010
Posts: 10
|
This script is targeting XP, Vista, 32 bit, and 64 bit. It does include x64.nsh and is modified based on clues from redxii and Animaether to work for all cases, but it still misbehaves. Is the logic bogus? Is the use of `C:\Windows\System32\java.exe` improper?
code: |
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
I'm not sure that logic is entirely correct... (I'm not sure detecting java being installed by checking for java.exe is correct either, but let's run with that...)
PHP Code:
PHP Code:
|
|
|
|
|
|
#6 | |
|
Senior Member
Join Date: Aug 2010
Posts: 104
|
Quote:
Maybe some other/ additional options for detection: - Regkey (HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft), I don't know where it would be on x64 systems - "Normally" if JRE is installed it is also added to the path variable Gunther |
|
|
|
|
|
|
#7 | |
|
Junior Member
Join Date: Oct 2010
Posts: 10
|
What is incorrect with my logic? Also: it looks like what you suggest below (in the first if block) will want to reinstall the jre if java.exe is in Windows\System32 on a 64 bit machine.
Quote:
|
|
|
|
|
|
|
#8 | |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
Quote:
![]() So basically it says this: -Unless- $SYSDIR\java.exe exists, install JAVA. The logic in your post says this in a 64bit environment... If $SYSDIR\java.exe, which is redirected to $WINDIR\SysWoW64\java.exe, exists -> Skip the install. Otherwise if C:\Windows\System32\java.exe, which is also redirected.. to C:\Windows\SysWoW64\java.exe, exists -> skip the install So basically, the filesystem redirection is what was mucking up the logic in your post. |
|
|
|
|
|
|
#9 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
Oh I'm sure it works... I'm just saying that I'm not sure it's "correct"... let me choose another word there: "appropriate"
|
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Oct 2010
Posts: 10
|
|
|
|
|
|
|
#11 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
On Windows, the ARP registry tends to be the most suitable in cases where the vendor doesn't offer any guidelines (and it doesn't look like Oracle/Sun do, except for end-users... click this, open that, look here, click there.. yikes.).
This... http://wpkg.org/Java#Java_Runtime_En...29_6_Update_10 ...might be a good place to start peeking. Mind you - I'm not saying that checking for java.exe is wrong.. it's probably perfectly fine and if you don't notice any negative effects, it's a lot simpler than going through the above. |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Oct 2010
Posts: 10
|
This is what actually worked on a Vista-64 with javaw.exe in C:\Windows\System32\
PHP Code:
I suppose I'll find some combinations that break this logic but should be able to figure those out. Thanks a million. |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Nov 2005
Posts: 115
|
Sounds easier to just use an exe wrapper for your program that will automatically redirect the user to DL Java if they haven't already installed it; like Launch4J.
I'm not really sure since I haven't voluntarily used or installed Java for quite a while but it shouldn't matter what bit of Java launches the program standing alone. It's just that in a 32-bit browser/application you can only load the 32-bit version of Java and with a 64-bit browser/application you can only load the 64-bit version of Java. The 64-bit version of Java doesn't include 32-bit support. |
|
|
|
![]() |
|
|||||||
| Tags |
| nsis fileexists |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|