Sunday, 8 November 2009

Erlets - Easier Erlang-Java interfacing

I've been helping a friend of mine out with an Erlang project and we needed to interface with Java. JInterface is a great start but it wasn't the easiest to figure out and start using. So I've created 'erlets' a simpler way to create a Java node that erlang can call:
public class MyErletServer {
   @ErlangFunction(module="pinger", function="ping")
   public OtpErlangObject ping(OtpErlangObject arguments) {
       return new OtpErlangString("pong");

   public static void main(String args[]) {
       Erlets server = new Erlets("java@");
       server.addFunctions(new MyErletServer());
This can then be called from Erlang:
$ erl -name 'erl@'
Eshell V5.7.3  (abort with ^G)
(erl@> rpc:call('java@', pinger, ping, []).
It's available here: