Skip to content Skip to sidebar Skip to footer

Run Python Script From Java

I am trying to run .py script in Java, but when I run the java code it doesn't show any output. What I am doing wrong? I tried with: ArrayList command = new ArrayList

Solution 1:

Try this:

Process p = Runtime.getRuntime().exec("python yourapp.py");

Exec runs system commands, if you have python installed, this will run the python file like you would in the command terminal of your operating system.

Post a Comment for "Run Python Script From Java"