Using libpurple with Java

Richard Laager rlaager at wiktel.com
Wed May 23 12:36:41 EDT 2007


On Wed, 2007-05-23 at 18:45 +0500, M Khalid wrote:
> Is it possible to use libpurple with Java. I know there is JNI
> available. But I am wondering if somebody has gone through all the
> pain of creating header file and compiling libpurple.

I doubt anyone has. I happened to have done some stuff with JNI at one
point, so I've thought (a little) about how this might work... I have no
time or desire to actually do this, but I can provide some tips.

If I was going to do this, I'd first see if there was something more
automatic. If not, then I'd create Java classes for all the public
libpurple APIs I wanted to wrap (e.g. PurpleBuddy). I'd have public
methods (that made it look as if everything was implemented in Java),
then have those call private native methods, which I'd implement in a
thin glue layer around libpurple. You would want to use a class
initializer to load libpurple.so, probably by way of some indirect class
(PurpleBuddy uses some protected PurpleImpl factory class that loads
libpurple.so once from its class initializer).


A quick Google search yielded this, which may be relevant...
http://developer.gnome.org/doc/API/java-gnome/

Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://pidgin.im/pipermail/devel/attachments/20070523/387d6346/attachment.sig>


More information about the Devel mailing list