Reputation: 719
I need to send a request to the server to run a jar file with a string argument/parameter and return the results as a string.
Upvotes: 0
Views: 235
Reputation: 76203
On server side you can run a process and send result back like this :
HttpServer.bind(InternetAddress.ANY_IP_V4, 3031).then((server) {
server.listen((HttpRequest request) {
var param = request.uri.queryParameters['name'];
Process.run('java', ['-jar', 'myJar.jar', param]).then((pr) =>
request.response
..write(pr.stdout)
..close()
);
});
});
Upvotes: 2