I am trying to get native messaging between a chrome extension and a Java program to work. After some struggling I now can open my Java program with:
var port = chrome.extension.connectNative('fbehost');
port.postMessage({ text: "Hello, my_application" });
But I don't know how I can read the message send from my extension. I created a program which opens a simple JFrame with a textarea. As it says in the documentation that native messaging communicates with stdin and stdout, I tried to get the message with:
while(true) {
try {
input=br.readLine();
tf.setAreaText(input);
} catch(Exception e) {
}
}
Also tried it with:
System.in.read()
The jar gets executed but the textarea stays empty. I can't find any information on the internet how to get the data in Java. Can you help me?
I haven't been able to get any native messaging to work in Google Chrome recently. I remember reading somewhere that a semi-recent update appeared to prevent compatibility between Java and Chrome for native messaging. Best of luck.