Nuxeo JS client : is it possible to use it in java 8 Nashorn console?

I'd like to use nuxeo.js in Nashorn javascript engine. The advantage is that it doesn't require to install node.js and can be used on any java8 VM console.

The problem is that nuxeo.js requires jQuery, and trying to load jQuery requires browser environment (like “window” object).

Any solution? What do you think about this approach? Thanks.

0 votes

1 answers

5892 views

ANSWER

It looks like the JS lib is also shipped for NodeJS. Did you try it ?

http://www.nuxeo.com/blog/nodejs-nuxeo-client/

06/25/2015

yes, trying to load "lib/node/nuxeo.js" fails :

jjs> load('node/nuxeo.js'); node/nuxeo.js:1 ReferenceError: "require" is not defined

loading "lib/jquery/nuxeo.js" succeeds, but fails later when executing client connect.

06/25/2015

Hi. Googling around on the topic gives this (maybe) interesting result:

http://blog.jonasbandi.net/2014/03/running-nodejs-applications-on-jvm-with.html

06/25/2015

Thanks for your research. I'll post back if I find any interesting outcome in this topic.
07/10/2015



Hi,

We have no plan yet to make nuxeo.js work directly in Nashorn. As it's only a JavaScript engine, it does not support XMLHttpRequest, so even if we remove the jQuery dependency, we won't be able to make any call.

You best bet, as Antoine Cordier suggested, is to try running it through Node.js.

1 votes