deb
Posts: 9
Joined: Fri Jan 06, 2006 8:07 am

Installaing bundled JRE after verification

Hi

Is it possible to install a bundled JRE with the application, only after verification that the proper version is not present on the target machine ?

I need JRE 1.5 with my app. I want to bundle it with my app but install it with the app only if the target machine has no JRE or JRE < 1.5.

Is this possible ?

Thanks
Deb
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,

Yes, this is possible.

1. In the Search page, create a registry search for the value "CurrentVersion" under the key: "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment". Name this Search JRE_VER. The value of this property will contain the current version of the JRE installed on the target computer.

2. In the Organization page, create a new Feature and move all the files associated with your package to this feature, such that "MainFeature" remains empty (it will contain only the bundled JRE, but this is not displayed in the tree control).

3. Set the Display option for "MainFeature" to "Not Displayed".

4. You also need to set a Conditional Install Level for "MainFeature" (the JRE) such that it will not be installed if it is already present on the target computer. Use the "Conditional" button at the right of the "Install Level" field and in the "Edit Conditional Levels" dialog set the Level to 0 (zero) and a condition like the following:

Code: Select all

(JRE_VER >= "1.5") AND (Not Installed)
Hope this helps.

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
deb
Posts: 9
Joined: Fri Jan 06, 2006 8:07 am

Thanks - one more question

Hey

Thanks a lot for that solution. It works.

Can you tell me one more thing?

If I install/write some files/registry keys from within an exe which is run as an "Exe with Working Directory..." in the Commit step, within my advanced installer setup, will the Advanced Installer Rollback or Uninstall -have knowledge about those files and registry settings ?

Thanks once again
Deb
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Deb,

Windows Installer does not have any knowledge about the actions performed from within a Custom Action. Moreover, if the Custom Action is executed after the Commit stage, the application is already installed, thus the setup will not rollback anymore if an error occurs. Therefore, the answer to your question is no.

The solution would be to schedule your Custom Action on the Install stage and set its Execution Option to "Deferred". You also need to schedule another Custom Action on the Rollback stage that will revert the modifications performed by the first one (delete the files and/or registry keys).

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
deb
Posts: 9
Joined: Fri Jan 06, 2006 8:07 am

Thanks for th reply

Hi
Thanks for the reply.

Now I got two more questions for you.

A) How can I pass command line arguements to an exe using the "Exe with working directory .." custom action ? Seems there is no place to specify !

B)

I know how to call a exe file from whithin a vbs file. But if the exe file needs other files to be in the same directory as the exe file - the exe is failing. This is what I have done

1) Used the temp directory in Files and Folder to add a vbs file, an exe file and few other ini/dll files. ( I used the temp directory as I do not want the APPDIR to have these files and I will delete them later at the end of installation)

2) In the install phase ( as deffered action) added a custom action to run the vbs file - which in turn runs the exe file using Return = WSHShell.Run("custominstall.exe",,true). This is because I will need to trap the return code and change the value of a session property.

Now I tried all the options - EXE with working directory , Attached Custom action , Installed Custom action etc - even by setting the current directory to the temp directory before the calling the .Run - but the exe just does not understand the working directory.

This problem vanishes if I run only the exe, as an Exe with working directory custom action. But in that case I cannot change the Session Property detecting the return code.

If there any way out from this ? Any directory issues ?

Thanks in advance
Regards
Deb
deb
Posts: 9
Joined: Fri Jan 06, 2006 8:07 am

Forgot to mention in my earlier post - the exe file needs to find those ini and dll files to be in the same working directory
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Deb,

I have answered your questions here:
http://advancedinstaller.com/forums/viewtopic.php?t=926

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”