0

I want to run a .py file from SpringBoot and then print the output of the file. I am using the following code and I am getting process[pid=aRandomNumber, exitValue="not exited"]

This is the code that I am using

String fetching = "python " + "c:\\Fetch.py \"" + word + "\"";
String[] commandToExecute = new String[]{"cmd.exe", "/c", fetching};
Runtime.getRuntime().exec(commandToExecute);
  • 1
    Does this answer your question? [How to run python from java correctly?](https://stackoverflow.com/questions/49132008/how-to-run-python-from-java-correctly) – Torben Oct 26 '22 at 04:19

0 Answers0