How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders. - Advanced Installer Community
taurus_ashwini
Posts: 17
Joined: Fri Dec 11, 2015 10:51 am

How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Hello,

To get the JAR path you can follow our "Browse for file" article steps.

Then, to run the JAR file as a custom action, take a look on our "Invoke a JAVA PROGRAM during Updating" thread debating this approach.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
taurus_ashwini
Posts: 17
Joined: Fri Dec 11, 2015 10:51 am

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

No, it is not like that. I want to invoke a jar file with parameters but at that point, the jar file is not yet extracted to APPDIR on target machine
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

In this case you should just add your JAR file as a temporary file.

Let us know if this helped, otherwise please give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
taurus_ashwini
Posts: 17
Joined: Fri Dec 11, 2015 10:51 am

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Thanks that worked.

One more thing, I would execute a custom action(invoking a jar file) on click of a next button.

If the custom action is successful, then it moves to next dialog.

Scenario If the custom action fails:

I would like to capture if the custom action failed, if yes I don't want the installation to end abruptly. Instead I would like to show a child dialog.

Could you please help me out with this?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Hello,

This would be possible only if you will create a wrapper custom action which will do the following things:

1. will run your JAR file
2. get the JAR exit code and save it into an installer property (e.g. RETURN_PROP)

For instance, you can write the wrapper custom action as a C# custom action.

Then, you can use a "Display a specific child dialog" event to display the desired dialog when the "RETURN_PROP" property is set to an error code.

Let us know if you have any doubts.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
taurus_ashwini
Posts: 17
Joined: Fri Dec 11, 2015 10:51 am

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Thanks for the reply.

I could create a custom action as suggested by you.

But how do I invoke this dll which has to be in temp folder in my scenario?

I tried with the following
1. Call function from attached native dll with Function: CustomAction1
2. Call function from standard dll temp file [AI_CUSTOMACTION1.CA.DLL] return type:Integer name:CustomAction1

But none worked.

Please reply ASAP.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Hello,

I'm not sure why this happens. Can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

Also, please try to debug your custom action and see if you are able to find out what exactly fails?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
taurus_ashwini
Posts: 17
Joined: Fri Dec 11, 2015 10:51 am

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Sorry attached native dll worked on my developement machine where I am referring the dll and build the aip file.. But why does it not work when trying to install on a test machine... Does AI need the file to be present on every machine??

The installer should be embedding that dll in itself right?

How can I achieve this? Am i missing anything?

I dont see any temp file in the temp folder apart from my other temporary files and the installer log.

Please reply ASAP
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Hello,

This may happen if the dependencies of your DLL are not found on target machine at install time. Can you please make sure the proper version of Net Framework required by your DLL is installed on your target machine? Also, if there are any third party dependencies of your DLL, they also must be installed on target machine.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
taurus_ashwini
Posts: 17
Joined: Fri Dec 11, 2015 10:51 am

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

This is my requirement.

1. I have to invoke a jar in temp folder.
2. My jar will successfully work if my parameters are fine
3. If the parameters are wrong, it will fail throwing an exception.(I can change my java code )
4. in the case of failure the installation is ending prematurely instead, I want to show a pop up that parameters are incorrect. so that user can reenter parameters and test.
5. The dll solution is working, but I cannot mandate .net framework to be a prereq for my application.

Please suggest any other solution for my problem.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Hello,
1. I have to invoke a jar in temp folder.
2. My jar will successfully work if my parameters are fine
For this you should develop and use your own custom action.
3. If the parameters are wrong, it will fail throwing an exception.(I can change my java code )
4. in the case of failure the installation is ending prematurely instead, I want to show a pop up that parameters are incorrect. so that user can reenter parameters and test.
To achieve this you should implement an approach like in my reply in the above.
5. The dll solution is working, but I cannot mandate .net framework to be a prereq for my application.
As another solution you can add the .Net Framework to be a launch condition for your setup. Just go to "Launch Conditions page -> Software tab" and configure .Net Framework as a launch condition. In this case the user won't be allowed to run the setup package as long as he doesn't have a proper version of .Net Framework installed.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
taurus_ashwini
Posts: 17
Joined: Fri Dec 11, 2015 10:51 am

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

No No you got me wrong, I dont want to mandate my user to have .net framework. I need some other solution where I can run jar and check if it fails and show a child dialog instead of prematurely ending the installation.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to invoke a jar file with parameters taken from the installer dialogs which is not part of files and folders.

Hello,

If you want to remove the .Net Framework dependency from your custom action, then you should create your custom action as a native DLL, instead of creating it using the WiX Toolset.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”