Try in Java with my open source library Ardulink.
I wrote the following example code without testing it but should be almost complete.
Link link = Link.getDefaultInstance();
link.connect(connectionPort); // connectionPort is a String, for example COM19 in windows
link.addRawDataListener(new RawDataListener() {
@Override
public void parseInput(String id, int numBytes, int[] message) {
// Write your code here
}
});
Let me know if you have some trouble.