When/how does the UNinstaller get called?
This simple demo. of using the ExtensionInstallerService
has me confused..
http://www.physci.org/jws/application.jnlp
It behaves as I expect oninstallation.
At time of installation, the user is prompted to
accept a psuedo 'license agreement'.
If they accept it, the application is launched.
If they refuse it, it is not launched.
If they refuse it, they can try again later and
the EULA dialog will be shown again, and
will continue to be shown, each launch, as
many times as the user refuses it.
But how/when is theuninstall option called?
In this example, I used the uninstaller option
simply to thank the user for using the application.
However, I do not ever see the 'thanks' dialog.
So far I have tried uninstalling the app. from both
theJava Control Panel, as well as Windows own
Add/Remove Programs dialog.
Does it work for anybody else?
The source for the installer that I am currently
using is as follows.
package test;
import javax.swing.*;
// classes of the web-start API, used in this example.
import javax.jnlp.ExtensionInstallerService;
import javax.jnlp.ServiceManager;
import javax.jnlp.UnavailableServiceException;
class Installer{
Installer(){
try{
ExtensionInstallerService installerService =
(ExtensionInstallerService)ServiceManager.
lookup("javax.jnlp.ExtensionInstallerService");
/* We do not need the progress bar as progress
is determined by the user accepting the EULA.
They can consider it as long as they like. */
installerService.hideProgressBar();
int result = JOptionPane.showConfirmDialog(null,
"Do you agree to the EULA?",
"End User License Agreement",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE );
boolean agree = (result==JOptionPane.YES_OPTION);
if (agree){
installerService.installSucceeded(false);
}else{
JOptionPane.showMessageDialog(null,
"Perhaps another time..");
installerService.installFailed();
}
}catch (UnavailableServiceException e){
e.printStackTrace();
}
}
publicstaticvoid main(String[] args){
if ( args[0].equals("install") ){
Installer installer =new Installer();
}else{
/* No need to do anything on uninstall,
but thank the user for their patronage */
JOptionPane.showMessageDialog(null,
"Thank you for using (Trivial) Application!");
}
}
}

