How to execute phantom.exit() in java script from JAVA program.
Actually the scenario is Java program calls a java script program using PhantomJs, java script program is returning some values to that Java program. Refer to this link : Running Phantomjs from javascript, JSP or Java
After getting values from javascript I need to stop javascript. For that I used phantom.exit() in javascript, which is not executing when I call it from Java Program. But it works fine when I execute the same javascript program from command promt using the command 'phantomjs myscript.js'.
The code is getting stuck in this line.. int exitStatus = process.waitFor(); It keep on waiting and it is not terminating.
So what is the way to terminate javascript from JAVA program?