Friday, July 15, 2011

NSIS - How to Embed Other Installers in Your Installer

Sometimes you may want to embed some other installer in your installer. As an example if you need Java as a prerequisite then you can embed Java installation inside your installer. Then it will run the Java installation before installing your application, when you run your installer. 

So let's write a section to embed JRE installer in your installer
Section "jre" SECJRE
  File "jre-6u14-windows-i586.exe"

  DetailPrint "Starting the JRE installation"   
  ExecWait "$TEMP\jre-6u14-windows-i586.exe" 
SectionEnd

In line 2 it is checking the existence of the file "jre-6u14-windows-i586.exe". At the point of compiling NSIS script, this exe should exist in the stated relative path (in this case it should be inside the same folder as the nsis script file). In line 5 it will execute the jre installer and your installation program will be suspended until JRE installation is completed. After the JRE setup is complete it will resume the installation of your application. In this way, you can embed any number of installers inside your installer.

This can be improved in many ways. Well, before installing JRE, you can check whether JRE is already installed in the system. In that case you can consider the version too. If it is not installed then you can use the above script to install JRE. Another improvement is, instead of installing a precise JRE you can download the latest version from Internet and then install. This nsis example shows a similar thing.

7 comments:

Raj said...

thanks u for your lovely post.hope it will help me out.

also visit my blog www.ethicalstuffs.blogspot.com

Hash said...

Nice tutorial. One little thing...

Line 5 should be ExecWait "jre-6u14-windows-i586.exe"

Chuck Williams said...

Or line two should include the /oname=$TEMP\jre-6u14-windows-i586.exe option to put the JRE installer into the temp directory.

Richard Carroll said...

Good Reads, Get in touch with us at Hotmail Support NZ +64-98890480 for Technical support and assistance.

Blogger said...

Water Hack Burns 2 lb of Fat OVERNIGHT

At least 160000 men and women are hacking their diet with a easy and secret "liquid hack" to burn 2lbs every night in their sleep.

It is simple and works all the time.

Here are the easy steps for this hack:

1) Take a drinking glass and fill it half full

2) Now use this weight loss hack

and you'll become 2lbs skinnier the next day!

Dove Cameron said...

Dove Cameron Plastic Surgery is something that we have always been interested in because of how big the change was. It has always been obvious to us that she has had plastic surgery but we never realized just how much she has had done until we really started digging into it today.

Cash backnear me said...

How many times have you wondered if there was an easier way to get cash back on your purchases? Maybe you are wondering how you would get all the things done on your daily to-do list, maybe that’s why you’re reading this article. Fortunately, there are a few ways to make this happen and make it easy for you to get cash back near me on things you already buy, such as groceries and gas.
Cash backnear me

Related Posts with Thumbnails