Frank Bastiaens
Posts: 17
Joined: Thu Apr 02, 2015 9:44 am

JAVA_HOME

Tue Oct 09, 2018 8:24 am

Hi,

Is it possible to find the JAVA_HOME value in the registry and use that as APPDIR?

Kind Regards, Frank

Frank Bastiaens
Posts: 17
Joined: Thu Apr 02, 2015 9:44 am

Re: JAVA_HOME

Tue Oct 09, 2018 9:07 am

I found more information, but it seems not available:

e.g. Get the value of: HKLM\SOFTWARE\WOW6432Node\JavaSoft\Java Runtime Environment\1.8\JavaHome
And that is almost possible with Searches > Extended Searches.
But it is not possible to read that value as path, it only uses comparisons.

Is there another way?

Kind Regards, Frank

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: JAVA_HOME

Tue Oct 09, 2018 2:15 pm

Hello Frank,

That is possible, but not by using the "New extended search" option. Instead, you can use a simple search (i.e. right click on the "Target Computer" --> "New Search") then add a search location for the earlier created search by right clicking on the search --> "Add search location" --> "Registry" with the following arguments:

Code: Select all

- Root: HKEY_LOCAL_MACHINE

- Key: SOFTWARE\JavaSoft\Java Runtime Environment\1.8

- Name: JavaHome
Now, in order to set the APPDIR property to the value of the search, please proceed as it follows:

- go to "Custom Actions" page and add a "Set installer property" custom action with sequence. To add a custom action with sequence, simply press the "Add custom action with sequeunce" button which is placed to the right side of the custom action name.

- the custom action arguments should be as it follows:

- Property: APPDIR
- Value: [TheNameOfYourSearch] (by default, the name of the search is "RESULT_PROPERTY", but that is easily changeable). By default, every search saves its value in a property which takes the search name.

- the last step is to drag and drop your "SetProperty" custom action from "Install Execution Stage" (where it is added by default) to "Wizard Dialogs Stage" and place it between the "Searches" action group and "Paths Resolution" action group.

Please let me know if that helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Frank Bastiaens
Posts: 17
Joined: Thu Apr 02, 2015 9:44 am

Re: JAVA_HOME

Wed Oct 17, 2018 11:14 am

Here's what I did:

Files, Folders and Shortcuts >
[*]Created an folder under Application Folder called bin
[*]Added an file in that folder.

Search >
[*]Added a new Search
[*]Added: Add search location Registry
[*]Pointed to: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Java Runtime Environment\1.8 > Value: JavaHome

Custom Actions:
[*]Created an Set installer property (Add custom action with sequence)
[*]Property: APPDIR
[*]Value: RESULT_PROPERTY
[*]Moved it to the Wizard Dialog Stage

Build:
[*]Build the MSI
[*]Start the MSI
[*]Error: Could not access network location RESULT_PROPERTY
[*]Even when I say it has to look in the 64bit of the registry.

What am I doing wrong?

Cheers, Frank

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: JAVA_HOME

Wed Oct 17, 2018 1:15 pm

Hello Frank,

From what I can see in what you have wrote, everything seems perfect except one thing. When you create the custom action, it should look like this:

-Property: APPDIR
-Value: [RESULT_PROPERTY] ---> not RESULT_PROPERTY


Attached you can find a screenshot in which I have create the "Set property" custom action:
Frank.PNG
Frank.PNG (44.72KiB)Viewed 5478 times
Please let me know if this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Frank Bastiaens
Posts: 17
Joined: Thu Apr 02, 2015 9:44 am

Re: JAVA_HOME

Thu Oct 18, 2018 9:40 am

Catalin,

That did it, only 1 error remains:

Code: Select all

The custom action 'Get_Javahome' was scheduled only in "InstallUISequence" table. It will not be executed during an un-attended installation
Where do I have to move the Custom action to? As it will be installed Un-attended.

Kind Regards, Frank

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: JAVA_HOME

Thu Oct 18, 2018 11:54 am

Hello Frank,

In this case, you can do two things:

1) Simply drag and drop the custom action in "Install Execution Stage" between "Searches" action group and "Paths Resolution" action group. You can do this if you know that your setup will only be installed silently.

2) You can share the custom action between the two installation stages and condition the custom action from "Install Execution Stage" to only execute if the custom action was not executed in "Wizard Dialogs Stage" (i.e. a silent install). To do that, simply SHIFT + drag and drop your custom action between the two stages (between "Searches" and "Paths Resolution" action groups) and then click on the custom action from "Install Execution Stage" --> under "Execution Stage Condition" click on "Advanced execution scenarios..." and then select the "Skip action in Install Execution Stage if executed in Dialogs Stage" radio button.

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”