Skip to content
⌘ NSIS Forum Archive

JRE Download failed

5 posts

ikus060#

JRE Download failed

Hello,

I'm using NSIS v2 from Debian Stretch for quite a while now as an installer. As part of the installation process, I've include this addons to download a JRE from https://nsis.sourceforge.io/File:JREDyna_Inetc.nsh

Recently, I'm running into trouble when using this plugins. It fail downloading the JRE proper with the error:

Détection de la version de JRE
JRE Version detection complete... Aucun JRE trouvé
Téléchargement de JRE à partir de http://javadl.sun.com/webapps/download/AutoDL?BundleId=98428
Download result = SendRequest Error
I've already verify, the URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=98428" is still working. I'm not sure what's wrong.

Help would be appreciated. Thanks

For reference here the files used to generate the packages:

Nutzzz#
Until recently, I used that header (though I've modified it a bit) and it worked for me. I suspect you just need to change your URL to https.

However, that version of JRE8 you link to is quite old, and Sun is stopping support and public updates in any case. It's probably time to switch to a JRE based on OpenJDK at this point. You could either use jlink to create your own custom JRE with just the components you need, or just grab a JRE msi from AdoptOpenJDK.
ikus060#
Originally Posted by Nutzzz View Post
Until recently, I used that header (though I've modified it a bit) and it worked for me. I suspect you just need to change your URL to https.

However, that version of JRE8 you link to is quite old, and Sun is stopping support and public updates in any case. It's probably time to switch to a JRE based on OpenJDK at this point. You could either use jlink to create your own custom JRE with just the components you need, or just grab a JRE msi from AdoptOpenJDK.
Hi Nutzzz,

Thanks for you reply. I will try to change the URL for https and update the JAVA version. As for moving forward with OpenJDK I would need some heaer file to reproduce it.

Do you mind sharing your header with me for both. Oracle JVM and OpenJDK ?

Thanks
Nutzzz#
For the Oracle one, you don't need an updated header; you can just update JRE_URL.

The nice thing about using OpenJDK is that you're permitted to redistribute it more flexibly. Our jlink'd slim JRE is only 38MB extracted, so rather than dealing with downloading it we just package the files with the installer. Also, as a support matter, it's sometimes nice to have a known quantity for the version of JRE being used.

If you would rather download an OpenJDK JRE with JREDyna_Inetc, you would change JRE_URL to e.g. the current latest LTS release, which is 11.0.6+10. For x64 the hotspot one is:

Or for x86:
https://github.com/AdoptOpenJDK/open..._11.0.6_10.msi.

You'll then set the Inetc::get line to download an .msi file instead of an .exe.

Then, assuming you want to enforce the optional entries to set JAVA_HOME and add it to the path, etc., then you would do so by installing it with:
ExecWait 'msiexec.exe /i <file>.msi /passive ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJavaHome,FeatureJarFileRunWith INSTALLDIR=<path>' $0
Note: Change "/passive" to "/quiet" for silent installs.
ikus060#
Finally, I figure out the problem is related to winInet security issue. raisd here
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


I've added this to my .nsi

; Download and install java and tweak the secure protocol for download.
; http://forums.winamp.com/showthread....198596&page=14
!define IE_NETCONFIG "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
ReadRegDWORD $9 HKCU "${IE_NETCONFIG}" "SecureProtocols"
WriteRegDWORD HKCU "${IE_NETCONFIG}" "SecureProtocols" 0x00000A80
call DownloadAndInstallJREIfNecessary
WriteRegDWORD HKCU "${IE_NETCONFIG}" "SecureProtocols" $9