SingleInstanceService not working
To anyone out that can help,
I'm building a download manager that uses JWS, and am using SingleInstanceService to prevent multiple instances. I can't seem to get this to work - here's my code
public static void main(String[] args) {
DownloadManager manager = new DownloadManager();
try {
final SingleInstanceService singleInstanceService = (SingleInstanceService)ServiceManager.lookup("javax.jnlp.SingleInstanceService");
final SingleInstanceListener listener = new SingleInstanceListener() {
public void newActivation(String args[]) {
//This is what will get called instead of main. Do the samething your main(String args[]).
}
};
singleInstanceService.addSingleInstanceListener(listener);
manager.setSis(singleInstanceService);
} catch (javax.jnlp.UnavailableServiceException ex) {}
Essentially the code exist when in tries to execute the first statement in the try catch block - when it attempts to lookup the service using ServiceManager! I don't understand why this is happenning! No exception is given or anything like that.
Any help on this would be much appreciated.
Thanks,
Chris

