I'm developing a google-chrome application and I need to launch a Java application. (Really, I need to read and save files without a choosefile pop-up).
As NPAPI library has been deprecated, I have looked for alternatives and I have decided to use "Native messaging hosts" to launch the external application.
To create my first example, I have tried to launch a shell script because I think that is more easy. However I have not managed to launch the script. I'm developing in linux
The manifest file is in this path
"/etc/opt/chrome/native-messaing-hosts/com.centeropenmiddleware.l3p1.xmleditor.json":
and the contain is:
{
"name": "com.centeropenmiddleware.l3p1.xmleditor",
"description": "Saving a file",
"path": "/home/paco2/pp.sh",
"type": "stdio",
"allowed_origins": [
"chrome-extension://plfnjepfbddljeogeacemcpceiofapnm/"
]
}
The application id is plfnjepfbddljeogeacemcpceiofapnm
the script creates a file:
#!/bin/bash
echo hola mundo >> aaa
The application code fails in this line:
try {
var port = chrome.runtime.connectNative ('com.centeropenmiddleware.l3p1.xmleditor')
} catch (e) {
console.log(e);
return;
}
The error caught is
{
message : "Error connecting to native app: com.centeropenmiddleware.l3p1.xmleditor",
stack : "Error: Error connecting to native app: com.centeropenmiddleware.l3p1.xmleditor
at Object.<anonymous> (extensions::runtime:189:11)
at Function.target.(anonymous function) (extensions::SafeBuiltins:19:14)
at Object.handleRequest (extensions::binding:55:27)
at Function.target.(anonymous function) (extensions::SafeBuiltins:19:14)
at Object.<anonymous> (extensions::binding:318:32)
at saveas (chrome-extension://plfnjepfbddljeogeacemcpceiofapnm/js/editorRoutines.js:104:35)
at HTMLButtonElement.sendFileContentFromEditor (chrome-extension://plfnjepfbddljeogeacemcpceiofapnm/js/editorRoutines.js:89:27)"
}
To launch the application I have used these commands
google-chrome --load-and-launch-app=/home/paco2/Projects/UPM/XMLEditor/XMLEditor/ --native-messaging-hosts="com.centeropenmiddleware.l3p1.xmleditor.json=/etc/opt/chrome/native-messaing-hosts/com.centeropenmiddleware.l3p1.xmleditor.json"
google-chrome --load-and-launch-app=/home/paco2/Projects/UPM/XMLEditor/XMLEditor/
I use the stablish google chrome version (34.0.1847.132)
Are there any wrong?