Question

This is the scenario I'm trying to achieve using Java API function: getRuntime

I have a sample python script, in the script after some functionality check, it require's some input from the user, this script I want to execute using getRuntime().exec() method. I know we can give command line arguments to the script through getRuntime().exec() method, but I'm not sure if the above scenario is possible using getRuntime().exec() method.

Is it possible to do it, please let me know?

Was it helpful?

Solution

Runtime.exec() gives you a Process. you can read and write to that Process (using getOutputStream() and getInputStream(), which allows you to get what's output by your script and send it more information afterwards. See for example this other thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top