If jinterface is too complicated, you can just use the package option in open_port and use
byte[] in_buf = new byte[256]; byte[] out_buf = new byte[256]; int in_count = System.in.read (); int offset = 0; do { int c = System.in.read (in_buf, offset, in_count-offset); offset += c; } while (offset < in_count);
To read packages from erlang and to write use:
System.out.write(out_count); System.out.write(out_buf, 0, out_count);
On the erlang side it will fit
open_port({spawn, "<path-to-java> -cp <classpath> your-java-prog", [{packet, 1}]).
If you need larger packages, use {package, 2} or {package, 4} and adapt java. Inside the packages, you can run any protocol that you like on both sides.
Peer stritzinger
source share