dougR
Posts: 21
Joined: Mon Nov 19, 2007 9:48 pm

Convert software launch condition into custom action using aicustact.dll?

Hello Everyone -

I have an installer I am working on, where it needs to check for a minimum version of both the JRE and JDK.

Using the software tab under launch conditions, I found the check works great when the MSI is first launched.

However, I am looking for a slightly different user experience.

Rather than using a launch condition, I would like to allow our customers to reach the Read Me step where they can see all the prerequisites. Then when they click on the next button, I would like to check for the JRE and JDK.

Taking a look the launch conditions for the JDK check, I noticed it was using the RequiredJdkExists method in aicustact.dll. Would it be possible to call this method from a custom action (without sequence) that is linked to a button? I've been trying to call it from a 'Call Function from an Attached Native DLL' custom action, but I am not sure if I am passing it the correct arguments or if it is not possible.

Thanks.

Doug
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Convert software launch condition into custom action using aicustact.dll?

Hi Doug,

Please note this approach is not recommended.
Also, starting with version 12.5 version of Advanced Installer some changes will be made. There will be a predefined list of properties that will be automatically filled during installation (JRE_MIN_VER_FOUND, JDK_MIN_VER_FOUND). Of course, the search will only be performed if the property is used, otherwise the search operation will not be performed.

In you case, here is what you can do. In the Search page, use a registry search operation in order to check the minimum version of installed JRE and installed JDK. For example, you can use the predefined Registry value containing a version Extended Search.

In order to check if at least the 1.7 X86 version of JRE is installed, the search can look like this:
MIN_JRE_1.7X86.png
MIN_JRE_1.7X86.png (12.11 KiB) Viewed 7593 times
In order to check if at least the 1.7 X86 version of JDK is installed, the search can look like this:
MIN_JDK_1.7X86.png
MIN_JDK_1.7X86.png (12.04 KiB) Viewed 7593 times
So, if at least the 1.7 version of JRE will be found on the target machine, then the property (MIN_JRE_1.7X86) assigned to the JRE 1.7 search operation will be filled. Otherwise the property will be empty. Same for JDK search.

If you want to search for a specific version of JRE or JDK (e.g. you only want to check version 1.7 if it is installed or not) please add the 1.7 as a maximum required version.

The sample project is attached to this thread, so if you are interested to take a look directly at my project, you are more than welcome to download the ZIP file.

If you have other questions, please let us know.

Best regards,
Dan
Attachments
Sample MinJRE and Min JDK check.zip
(3.22 KiB) Downloaded 479 times
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dougR
Posts: 21
Joined: Mon Nov 19, 2007 9:48 pm

Re: Convert software launch condition into custom action using aicustact.dll?

Hi Dan -

Thanks for the quick response.

After using your product for nearly 8 years I really appreciate how I can post a question or send a request to support at the end of my day and often get a response by the following morning. Awesome!

I was finally able to schedule some time to look at your example and found it worked great for 32-bit versions, but not for 64-bit. (Looking back at my original post I see I left that requirement off - oops.)

After learning that Extended Searches did not support searching the 64-bit registry, I came across this gem http://www.advancedinstaller.com/forums ... 177#p52827 which recommended modifying the "Platform" field of the "AI_AppSearchEx" table in the table editor and found it worked great.

Based on the minimum version found, I was hoping to create an additional search to find the JavaHome and came across something that left me a bit confused.

Using the following registry search, it was not returning anything.

Root: HKEY_LOCAL_MACHIONE
Key: SOFTWARE\JavaSoft\Java Development Kit\1.7
Name: JavaHome
Type: The value contains a path to a directory
Search the 64-bit portion of the registry is selected.

However, switching the type to 'Retrieve the raw value' I found it was returning 'C:\Program Files (x86)\Java\jdk1.7.0_75'. This path does not exist, which explains why it was previous returning null. Manually checking the registry HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.7\JavaHome, the value is in fact C:\Program Files\Java\jdk1.7.0_75.

Making things even more interesting, I used Microsoft's Process Monitor (the sysinternals tool) I could see that msiexec.exe did actually read the correct 64-bit value out of the registry.

The next thing I'll probably try is an inline script where I dynamically build the path for the 64-bit registry, and set a session property but I ran out of time today.

A number of additional questions for you.

1) Is it possible to use a property in the registry search key?
Instead of hard-coding version number 'SOFTWARE\JavaSoft\Java Development Kit\1.7' I was interested in using the value returned by another search 'SOFTWARE\JavaSoft\Java Development Kit\MIN_JDK_1.7X64'

2) When using prerequisites, I see it requires the bootstrapper. Is there a way to determine if the installer has been launched from the bootstrapper?
If a customer runs the bootstrapper, I would like to display our readme but when they get to the installer I do not need to display it a second time. And if they run the installer directly, I would probably also need to check for Java again.

3) Are there any plans to add Java Cryptography Extension (JCE) as a prerequisite?
When installing our application, we need to have the JCE installed that is the correct version for the version of Java that is installed.

4) Is there a tentative release date for 12.5?
If it is really close, I could see with sticking with our current approach of a launch condition.


Whew, I think that's it for now…

Thanks again!

Doug
dougR
Posts: 21
Joined: Mon Nov 19, 2007 9:48 pm

Re: Convert software launch condition into custom action using aicustact.dll?

I did have a chance to test out an inline script for reading the correct 64-bit JavaHome value out of the registry for both the JRE and the JDK based on the minimum version found.

In case anyone is interested, I have attached the modified version of the sample project Dan originally provided.
Sample MinJRE and Min JDK check-64bit.zip
(3.84 KiB) Downloaded 418 times
Doug
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Convert software launch condition into custom action using aicustact.dll?

Hi Doug,
In case anyone is interested, I have attached the modified version of the sample project Dan originally provided.
First of all, thank you for sharing this with us. I'm sure it will help other users.
1) Is it possible to use a property in the registry search key?
We don't have predefine support for this. However, I have added an improvement on our TODO list and it will be available in a future version of Advanced Installer. Thank you for your suggestion.
2) When using prerequisites, I see it requires the bootstrapper. Is there a way to determine if the installer has been launched from the bootstrapper?
When the boostrapper launches the .MSI, the SETUPEXEDIR property is passed to the .MSI. This property contains the value of the directory where the .EXE is. If this property is empty in the .MSI, then the MSI was not launched by the bootstrapper.

However, starting with 11.3 version of Advanced Installer a launch condition is automatically added at build-time in the EXE packages. If you try to launch the .MSI, you will receive the following meessage:

Code: Select all

 "This package can only be run from a bootstrapper" 
3) Are there any plans to add Java Cryptography Extension (JCE) as a prerequisite?
I have added your request on our TODO list. Thank you for your suggestion.
4) Is there a tentative release date for 12.5?
The 12.4 version has just been released. I'm afraid I don't have an expected release date for the 12.5 version. Most likely it will be around the end of October, beginning of November.

If there is anything else I can help you with, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dougR
Posts: 21
Joined: Mon Nov 19, 2007 9:48 pm

Re: Convert software launch condition into custom action using aicustact.dll?

Dan -

Thanks for all the answers, I appreciate it.

Doug
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Convert software launch condition into custom action using aicustact.dll?

You're always welcome Doug,

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dougR
Posts: 21
Joined: Mon Nov 19, 2007 9:48 pm

Re: Convert software launch condition into custom action using aicustact.dll?

For those interested in the sample project I posted, I just caught mistake.

Be sure to change the following line in the inline VB Script for the custom action labeled 'SetJREHome'

Code: Select all

strJREVersion = Session.Property("MIN_JDK_1.7X64")
to

Code: Select all

strJREVersion = Session.Property("MIN_JRE_1.7X64")

Return to “Common Problems”