0

I have Nodejs - server.js code in my windows system from which i want to execute a simple jar file.

So i used follwoing code :

   cmd = "java -jar C:\\libs\\sample.jar";

   var Exec =exec(cmd, function(error, stdout, stderr) {

   if (error !== null) {

   console.log('exec error: ' + error);

   }//end of if

   });//end of exec cmd

When i run the "node server.js" in command prompt ,jar is executing perfectly.

After this i made this "node server.js" command as service by referring following link :

https://github.com/coreybutler/node-windows

i.e node-windows,But now once its become service i am unable to exectue simple.jar,even i am enble to run simple "java -version" command.

Except java all other command are working fine even after i made nodejs as service.

Please help me out.....

New Update : After testing lot of different cases, Finally i came to know that jars containing JFrame components is not opening...how to solve this

  • Could it be that the `java` command is not on the %PATH% that is in effect the `node` command is executed? – Stephen C Feb 01 '16 at 10:36
  • no its in path only... In command prompt i am able to get java in any path...and i have "java bin" in environment variable. – shadanana upadhya Feb 01 '16 at 10:42
  • new update : jar file congaing simple system.out.println is working fine.But jar containing JFrame components are not executing... Please help me... – shadanana upadhya Feb 02 '16 at 07:48

0 Answers0