I am trying to run command line commands from Java and a quick sanity check made me realize that the reason I am having trouble is that I can\'t get the pr.waitFor()
pr.waitFor()
You should try this:
Process pr = rt.exec(new String[]{ "bash","-c", "sleep 32; echo $RANDOM" });
This launches a shell process and then within the shell runs your commands. The shell doesn't return till AFTER the commands have completed.
Let me know if that works for you.