I can execute Linux commands like ls
or pwd
from Java without problems but couldn\'t get a Python script executed.
This is my code:
You cannot use the PIPE inside the Runtime.getRuntime().exec()
as you do in your example. PIPE is part of the shell.
You could do either
.exec()
orYou can do something similar to the following
String[] cmd = {
"/bin/bash",
"-c",
"echo password | python script.py '" + packet.toString() + "'"
};
Runtime.getRuntime().exec(cmd);