1

I have a node.js application where I'm trying to run a jar file and get the result. I succeeded using this code.

var exec = require('child_process').exec;
var child = exec('java -jar ./helloworld.jar',
function (error, stdout, stderr){
    console.log(jardata,"jar out...");
    if(error !== null){
        console.log("Error -> "+error);
    }

This works well in my local system. But when I do a cf push of this app to Bluemix, the app gets deployed, but gives me a java: not found error when it is trying to run the jar file. Is it possible to install java within the node.js application? Or how can we do this on Bluemix running a jar within a node.js application? Any help appreciated!!

ralphearle
  • 1,696
  • 13
  • 18
user7350714
  • 365
  • 1
  • 6
  • 20
  • 1
    Possible duplicate of [How to run a jar file with node.js child\_process API?](http://stackoverflow.com/questions/12892195/how-to-run-a-jar-file-with-node-js-child-process-api) – 0xdw Mar 16 '17 at 15:35
  • @DININDU This is completely different...Im asking about how to deploy on bluemix ..Not on my local machine – user7350714 Mar 16 '17 at 15:37
  • 1
    More likely duplicate: http://stackoverflow.com/questions/42776516/cloudfoundry-how-to-combine-two-runtimes – amadain Mar 16 '17 at 15:39
  • In which folder have you kept your jar file? – RiyaMRoy Mar 16 '17 at 17:05
  • @amadain Thanks.It worked.@RiyaMRoy In my main project folder itself – user7350714 Mar 16 '17 at 17:50
  • 1
    Possible duplicate of [Cloudfoundry : How to combine two runtimes](http://stackoverflow.com/questions/42776516/cloudfoundry-how-to-combine-two-runtimes) – Alex da Silva Mar 20 '17 at 18:30

0 Answers0