node-java with node-webkit

1 062 katselukertaa
Siirry ensimmäiseen lukemattomaan viestiin

kungfum...@gmail.com

lukematon,
1.10.2014 klo 10.32.541.10.2014
vastaanottaja node...@googlegroups.com
Hello,

I'm trying to get node-java to work with node-webkit. I have js/main.js with this content:


var java = require("java");

var ArrayList = java.import('java.util.ArrayList');
var list = new ArrayList();
list.addSync('item1');
list.addSync('item2');

console.log(list.sizeSync());

When I run

node js.main.js

I get the expected behavior. When I run

npm start

Webkit opens my main html file which loads and runs the above JS. I get this error:

"Uncaught Error: Module did not self-register.", source: module.js (354)

I do not get this error requiring other modules (although I do get the "require is not defined" error in the webkit console).

I do not know if this is a problem with node, node-java, or node-webkit. I'm running Mac OS X 10.9.5, node v0.10.28, npm 2.1.2. node-webkit is installed locally in my project and is 64-bit.

Thanks for any guidance.

/Daryl

Joe Ferner

lukematon,
1.10.2014 klo 11.03.521.10.2014
vastaanottaja node...@googlegroups.com
I'm not entirely familiar with node-webkit but I believe you have to compile native modules using their tool: https://github.com/rogerwang/node-webkit/wiki/Build-native-modules-with-nw-gyp

kungfum...@gmail.com

lukematon,
1.10.2014 klo 11.10.371.10.2014
vastaanottaja node...@googlegroups.com


On Wednesday, October 1, 2014 11:03:52 AM UTC-4, Joe Ferner wrote:
I'm not entirely familiar with node-webkit but I believe you have to compile native modules using their tool: https://github.com/rogerwang/node-webkit/wiki/Build-native-modules-with-nw-gyp

Thanks Joe, I'm new to node as well so I don't understand building, but at least I have a direction to pursue.

/Daryl

Joe Ferner

lukematon,
1.10.2014 klo 11.11.571.10.2014
vastaanottaja node...@googlegroups.com
let me know if you have any luck and we can add it to the readme.

kungfum...@gmail.com

lukematon,
1.10.2014 klo 21.52.451.10.2014
vastaanottaja node...@googlegroups.com


On Wednesday, October 1, 2014 11:11:57 AM UTC-4, Joe Ferner wrote:
let me know if you have any luck and we can add it to the readme.

Following these build instructions (and also these):
./compile-java-code.sh
node-gyp configure build
npm test

I managed to get through the first 2 steps, but the third gets me this:

Error: Cannot find module '../build/jvm_dll_path.json'

Any ideas? Also if I succeed with the build, how do I then install?

Thanks.

/Daryl

Joe Ferner

lukematon,
2.10.2014 klo 8.40.592.10.2014
vastaanottaja node...@googlegroups.com
I thing you just need to run the postInstall.js script in node-java home.

I've updated the readme with instructions. https://github.com/joeferner/node-java#installation-node-webkit

kungfum...@gmail.com

lukematon,
2.10.2014 klo 13.01.272.10.2014
vastaanottaja node...@googlegroups.com


On Thursday, October 2, 2014 8:40:59 AM UTC-4, Joe Ferner wrote:
I thing you just need to run the postInstall.js script in node-java home.

Thanks, that got me further. Then I hit an architecture mismatch and tried this:

nw-gyp clean configure build --verbose --arch=ia64

That gets me this:

gyp WARN install got an error, rolling back install 

So maybe the Webkit I've got doesn't have headers published for the version of node I've got. It's starting to smell like my issues are well outside node-java so I think I'll try making a client/server with java-node on the server side which seems to work. I'll stop bothering you here...

/Daryl

t3hmrman

lukematon,
25.1.2015 klo 17.22.0625.1.2015
vastaanottaja node...@googlegroups.com
Super late, but joined group just to reply here...

The nw-headers get failure occurs because you didn't specify a --target during the configure step.

Usually something like this will work:

nw-gyp configure --target=[0.8.6|0.11.6|other nw version]
nw-gyp build
Vastaa kaikille
Vastaa kirjoittajalle
Välitä
0 uutta viestiä