Java Growl (libgrowl, azgrowl-0.1.jar)

174 views
Skip to first unread message

jta23

unread,
Aug 5, 2009, 1:08:44 PM8/5/09
to growl for windows
Is anyone, anywhere using Growl with Java on Windows?

There is a minimalist post (http://blog.growlforwindows.com/2009/04/
new-java-growlgntp-library-available.html) that has code that doesn't
work (or at least doesn't include the instructions necessary), there
is no documentation anywhere, no examples. Growlforwindows.com claims
"Complete instructions and sample code are available with each
library" but this is not the case for the Java link.

Any pointers appreciated, thanks!

Brian Dunnington

unread,
Aug 5, 2009, 1:52:10 PM8/5/09
to growl-fo...@googlegroups.com
a few people on the discussion group have reported using the Java
libraries, but i only know of two who posted their results. one is the
same author of the libgrowl Java library, who uses it in his Azureus
plugin, and the second is here:

http://www.jmdb.de/content/eng/news/news.html#20090509notification

it doesnt go into too much detail, but maybe you can contact the
developer with any questions? also, i know that at least one person
had trouble with the library because they were using an outdated
compiler. i have had confirmations that it works with the 1.6 JDK.

my Java skills are minimal at best, so i probably cant help much with
getting your environment set up to use the library. maybe another user
with more Java knowledge will post up some simple steps to follow.

jta23

unread,
Aug 5, 2009, 2:35:17 PM8/5/09
to growl for windows
Thanks for the pointers; I'll post a solution if/when I find it!

Dave

unread,
Aug 6, 2009, 8:57:47 AM8/6/09
to growl for windows
I have managed to get my Java application sending growls. I am
currently being very simplistic about things and simply sending
messages with my own icon. I am using 1.6 and it seems to work
well ...

Brian Dunnington

unread,
Aug 6, 2009, 12:32:07 PM8/6/09
to growl-fo...@googlegroups.com
if you want to write a blog post or put up a webpage about your
experience or just a how-to on how you did it, that would be awesome
and very helpful for other folks looking to integrate GfW with Java.

Dave

unread,
Aug 6, 2009, 5:17:39 PM8/6/09
to growl for windows
I will happily do that, though all I did was follow the instructions.
Some of them don't work, but they were enough for my relatively simple
needs ... happy to help though :-)

On Aug 6, 5:32 pm, Brian Dunnington <briandunning...@gmail.com> wrote:
> if you want to write a blog post or put up a webpage about your
> experience or just a how-to on how you did it, that would be awesome
> and very helpful for other folks looking to integrate GfW with Java.
>

Brian Dunnington

unread,
Aug 6, 2009, 5:20:06 PM8/6/09
to growl-fo...@googlegroups.com
> I will happily do that, though all I did was follow the instructions.
> Some of them don't work,

exactly the reason a new write-up would be so great =)

if you do post something up, let me know about it and i will post
about it on the main GfW site. thanks for using GfW and helping to
spread the cause.

Dave

unread,
Aug 31, 2009, 10:29:11 AM8/31/09
to growl for windows
Here is some code I used to get Windows Growling in Java. I haven't
played with this specifically for a while but I am pretty sure it
works - I plan to return to it soon. In the mean time I am happy to
take any questions...

<code>
class Gfw {
public static enum NType {
TRANSFERRED, GENERIC, STARTUP, COMPLETE
};
public static NotificationType downloadComplete, fileTransferred,
generic, startup;
private static Application application;
private boolean growlRunning;

public Gfw() {
initGrowlForWindows();
}

private void initGrowlForWindows() {
application = new Application("myApp");
File f = new File(".." + File.separator + "bin" + File.separator +
"insticon.png");
application.setIcon(f.getAbsolutePath());


downloadComplete = new NotificationType("COMPLETE", "Download
Complete");
fileTransferred = new NotificationType("TRANSFERRED", "File
Transferred");
generic = new NotificationType("GENERIC", "Generic Message");
startup = new NotificationType("STARTUP", "Startup Message");

int rc = growl.register(application, new NotificationType[]
{ generic, startup, fileTransferred, downloadComplete })

if (rc == 0) {
growlRunning = true;

Notification notification = new Notification(application,
startup, "Started", "myApp has Started", "STARTUP");
growl.notify(notification);
}
}
}
</code>


On Aug 6, 10:20 pm, Brian Dunnington <briandunning...@gmail.com>
wrote:

jta23

unread,
Aug 31, 2009, 12:55:52 PM8/31/09
to growl for windows
Thanks for the posting!

A couple questions:

1.) You don't show how you create the "growl" object above. I'm doing
this:

GrowlConnector growl = new GrowlConnector(hostname);

where "hostname" is the name of the local host.

2.) What about imports and the classpath? I am doing this:

import net.sf.libgrowl.*;

and adding libgrowl-0.1.1.jar to the cp.

3.) The code runs for me but it never does a popup because rc is zero.
If I force it to send the notification I get this:

"You need to register the notification type Startup Message before
using it in notifications."


I'm pretty sure this is due to something in 1.) or 2.) above. I guess
I'm not creating the GrowlConnector correctly, or I'm not linking
against something I should.

Thanks again,

Jonathan

Derek Battams

unread,
Sep 2, 2009, 12:06:25 AM9/2/09
to growl for windows
On Aug 31, 12:55 pm, jta23 <jonathanhalc...@gmail.com> wrote:
>
> 3.) The code runs for me but it never does a popup because rc is zero.
> If I force it to send the notification I get this:
>
> "You need to register the notification type Startup Message before
> using it in notifications."
>
> I'm pretty sure this is due to something in 1.) or 2.) above. I guess
> I'm not creating the GrowlConnector correctly, or I'm not linking
> against something I should.
>
> Thanks again,
>
> Jonathan

I'm pretty sure you're seeing the same problem I am, and that is if
you do not connect to Growl via the loopback interface (IP 127.0.0.1)
then Growl rejects all communication because this Java library does
not support the sending of a password. You can also break things
connecting to localhost by checking the "Require password for local
apps" checkbox on the Security settings. Basically, unless this Java
library is updated to support password transmission then the library
can only be used to connect to a local Growl instance and only if that
Growl instance allows local apps to notify without a password.

Derek Battams

unread,
Sep 2, 2009, 3:38:40 AM9/2/09
to growl for windows
I've created a patch for libgrowl that accepts a password in the
GrowlConnector constructor and will send that password to the Growl
instance when needed. I've tested it and it seems to be working quite
nicely - now I can notify remote Growl installations via Java.

I couldn't find anywhere to submit the patch on the libgrowl project
site, but if someone needs it then let me know I can probably post the
patch here so you can build an updated libgrowl locally. The patch
requires Apache commons codec library. I got lazy and took the easy
way out for the md5 hex encoding. :)

jta23

unread,
Sep 2, 2009, 11:43:32 AM9/2/09
to growl for windows
I changed it to

GrowlConnector growl = new GrowlConnector();

and it works fine! (I only want to send local notifications anyway)

Thanks Dave and Derek!

Patrick von Reth

unread,
Oct 28, 2009, 6:44:08 AM10/28/09
to growl for windows
Hi I'm using the library in my project jWeatherWatch and as far as I
know it currently works quiete well with Growl for Windows, but some
time ago I asked a friend to test it on his mac with Growl and it
doesn't worked.
Do you know where is the problem? I thought GNTP is the same on mac
and windows, correct me please if I'm wrong or do you need to activate
GNTP support on mac first?
Would be great if you can give me the reason for that issue and yes I
know this is the Growl for Windows Group but maybe you now something
interesting ;)

Greetings Patrick

Brian Dunnington

unread,
Oct 28, 2009, 10:13:01 AM10/28/09
to growl-fo...@googlegroups.com
Growl (on the Mac) doesnt support GNTP at all yet. they are working on
it (it is working in a version in their source repository) and it will
be included in their 1.3 release.

both GfW and Growl on the Mac support the Growl UDP protocol, but it
is limited in what it can do (no images, no callbacks, etc - hence the
reason GNTP was developed).

Patrick von Reth

unread,
Oct 28, 2009, 11:11:37 AM10/28/09
to growl for windows
Ok that explains why it doesn't work, then I'll wait with my mac tests
for the 1.3 release .

PS:I wrote a small patch for lib growl so that it is possible to check
if Growl is listening and the application doesn't crash with a
ConnectException, but as Derek Battams said there is no way to upload
it or to communicate with the libgrowl developer.


On Oct 28, 3:13 pm, Brian Dunnington <briandunning...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages