Custom Action - Source Type jar - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

rand
Posts: 22
Joined: Tue Sep 29, 2009 4:10 pm

Custom Action - Source Type jar

I am evaluating Advanced Installer for some Java products, most everything is now working, but I cannot
figure this one thing out.

I need functionality that will allow me to perform some actions during (but prior to) an uninstall.

The code for this functionality is in the same jar file that my application resides in.
So after some researching, a custom action seemed the way to achieve this.

- I created a custom action under InstallExecuteSequence - Uninstall

Source Path: = path to my jar
Source Type = .exe (jar is not an available option?)
Command Line = javaw -jar "[APPDIR]\\[#App.jar]" -UNINSTALLACTION
Synchronous execution, ignore return code
Deferred
Always Execute
REMOVE="ALL"

AI never seems to be calling this code during uninstall.
I image because Source Type is set to exe. Or perhaps my command line syntax is incorrect?

Is there a way to have the target of a custom action in a jar?
or
Am I going to have to remove the desired functionality out of the main App.jar, package up the files I need and create a separate exe?

Am I missing anything?

Thanks
rand
Posts: 22
Joined: Tue Sep 29, 2009 4:10 pm

Re: Custom Action - Source Type jar

I think I found part of my problem.

I was using an attached custom option, I have changed that to an installed custom action.
Still does not seem to be running during an uninstall prior to the uninstall taking place.

I have attached a screen shot of my AI custom action screen.

I am going to capture some logging using msiexec to see if I can figure out what I am doing wrong.

In the meantime, does anyone see my error?

Thanks for the help.
Attachments
Installed Custom Action.gif
Installed Custom Action.gif (52.71 KiB) Viewed 3149 times
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom Action - Source Type jar

Hello,

Please note that the full path to your .jar file is held in [#App.jar], the [APPDIR] before it is unnecessary.
Another thing to note is that the [APPDIR] property already contains the '\' (backslash) character appended to its value, so "[APPDIR]\" is not valid.
Last, if you are deploying a Java product, it is highly recommended that you read our comprehensive tutorial on Java Product Installation to better help you understand how to use Advanced Installer in efficiently deploying your Java application.

Regarding launching a .jar custom action, it is recommended that you use an "EXE with Working Dir" to launch java.exe so that it runs your .jar.

If you need further help, do not hesitate to contact us.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
rand
Posts: 22
Joined: Tue Sep 29, 2009 4:10 pm

Re: Custom Action - Source Type jar

Thank you for the response, it is working now, adding this comment to document how
I got it working, perhaps helping someone else down the road.

I figured out after using the logging functionality that my command line syntax was all wrong (as you noted in your post)
At your suggestion, changed the Custom Action to be an EXE with working directory custom action (i have it as an installed custom action)

The correct full path syntax is: "[%JAVA_HOME]\jre\bin\javaw.exe" -jar "[#App.jar]" -UNINSTALLACTION

One concern is that in the future if sun changes the directory structure of the jre delivery to somewhere other than jre\bin from JAVA_HOME then my uninstall will not be able to find javaw.exe.

I found in another post about using a Search to locate the jvm, so I am going to explore that route for a better full path command.

Thanks for the help, I think we are going to be able to use Advanced Installer.

UPDATE: full path of javaw -jar "[#App.jar]" -UNINSTALLACTION works fine

Return to “Common Problems”