I have written a program, where I have to send an
ArrayList to Java code through my NodeJS program.
The java program sends back an
ArrayList to Nodejs as a response.
I am able to send the
ArrayList to Java, and do manipulations.
Sending back the
ArrayList from java is also working fine since I have used the
System.out.print to verify that.
The problem is in receiving the
ArrayList in Nodejs.
Below is the sample code I had written. The NodeJS is printing only
"Item_2" twice in the output, whereas it should have printed
"Item_1" and then
var confList = java.newInstanceSync("java.util.ArrayList");
var dataList = java.newInstanceSync("java.util.ArrayList");
var javaApp = java.newInstanceSync("TestJava");
javaApp.getData(confList, function(err, ret)
console.log("getData method in Java failed" + err);
dataList = ret;
var data = dataList.getSync(0);
var data = dataList.getSync(1);
public class TestJava
public ArrayList<String> getData(ArrayList<String> conf) throws Exception
ArrayList<String> list = new ArrayList<String>();
for(String val: conf)
val = //some modifications in conf;