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@127.0.0.1");
server.addFunctions(new MyErletServer());
server.start();
}
}
This can then be called from Erlang:
$ erl -name 'erl@127.0.0.1'
Eshell V5.7.3 (abort with ^G)
(erl@127.0.0.1)1> rpc:call('java@127.0.0.1', pinger, ping, []).
"pong"
It's available here:
http://bitbucket.org/dale.thatcher/erlets