This is the first time I am trying python in java. I am trying to execute python script from my code as follows.
Process process = Runtime.getRuntime().exec("python C:\\Users\\username\\Desktop\\demo\\filename.py");
But I am getting following exception
"Cannot run program "python": CreateProcess error=2, The system cannot find the file specified"
I have installed python. I am not sure why the file is not found. I tried to follow this link but it did not solve my issue.
Thanks in advance.
Edit 1
I tried the sample code given by "Viacheslav Vedenin", it worked when I executed my java(servlet) program. But when I ran the same function from JSP button click event, it did not work. It gave me following error
java.io.IOException: Cannot run program "python": CreateProcess error=2, The system cannot find the file specified
Please help me to resolve this issue.