I'm writing a program requiring communication between Java and Erlang using JInterface. I've a problem with receiving a list from an Erlang process - somehow the object I get in Java is not a OtpErlangList but OtpErlangString and if I try to cast the received object to OtpErlangList, I get a cast exception. I've tried decoding the string, but it seems not to be the case.
It seems to me rather odd not be able to send a list from Erlang to Java, could you please take a look if I'm not making any basic mistake?
Java fragment:
OtpErlangObject erlangObject = mailbox.receive();
OtpErlangList erlangList = (OtpErlangList) erlangObject;
System.out.println(erlangList.toString());
Erlang fragment:
List = [1, 2, 3, 4],
JavaPid ! List
I'm omitting the rest of the code as I believe these are the lines where the problem is - I've tried it with other classses and it worked.