thanks to Bananeweizen, there is now a Java GNTP library available:
https://sourceforge.net/projects/libgrowl/
// connect to Growl on the given host
GrowlConnector growl = new GrowlConnector("hostname");
// give your application a name and icon (optionally)
Application downloadApp = new Application("Downloader", "http://example.com/icon.png");
// create reusable notification types, their names are used in the Growl settings
NotificationType downloadStarted = new NotificationType("Download started", "c:\started.png");
NotificationType downloadFinished = new NotificationType("Download finished", "c:\finished.jpg");
NotificationType[] notificationTypes = new NotificationType[] { downloadStarted, downloadFinished };
// now register the application in growl
growl.register(downloadApp, notificationTypes);
// create a notification with specific title and message
Notification ubuntuDownload = new Notification(downloadApp, downloadStarted, "Ubuntu 9.4", "654 MB");
// finally send the notification
growl.notify(ubuntuDownload);
now there is no excuse not to build Growl/GNTP support into your Java applications! =)


is Java lib support Growl callback?
ReplyDeleteTry to use this code with the windows growl's version.
ReplyDeleteThe compiler say :
"Cannot access net.sf.libgrowl.GrowlConnector, bad class file: libgrowl-0.1.1.jar
class file has wrong version 49.0, should be 48.0"
Any idea ?
Ok, my compiler was too old, no problem with the 1.6jdk.
ReplyDeleteEverything works fine :D
There is a VERY good excuse not to use that library - it's GPL (not LGPL), meaning you have to make your whole app GPL as well if you want to use it.
ReplyDelete