YaroslavGaponov / node-jvm

java virtual machine in pure node.js
2.11k stars 176 forks source link

How to get the result(response) from this jvm? #27

Open mantinghui opened 7 years ago

mantinghui commented 7 years ago

I mean,i want to get the result from a java function,can this node-jvm do this?

YaroslavGaponov commented 7 years ago

I think you can to create java code which run some java function and result will pass to javascript code like this https://github.com/YaroslavGaponov/node-jvm/tree/master/examples/jsclass

mantinghui commented 7 years ago

It‘s great!Thank you.But……there is still a small problem that when i send an int as an input parameter in Java class,the function and other functions behind it didn't work.They had done nothing.My own code just like this: (MyJsClass.js) MyJsClass.prototype.setaaa = function(i) { console.log("i:"+i); abc.aaa = i; } MyJsClass.prototype.showaaa = function() { console.log(abc.aaa); } (IMyJsClass.java) void setaaa(int i); void showaaa(); (Main.java) obj.setaaa(333); obj.showaaa();

But when i send a String parameter,it‘s working normally.

18876293672 commented 5 years ago

can you provide documents for this results,i don't know how to operate it