Tag:try command execution java bsp main rgs com ror glin
public class test{ public static void main (string[] args) {
try {
String shellstring =" Lame-b 16/java/5/a.wav "; string[] cmd = new string[]{"sh", "-C" , Shellstring}; Process process = Runtime.getruntime (). exec (cmd);
Process process=runtime.getruntime (). EXEC ("Lame-b 16/java/5/a.wav"); Lame your. wav file, easy version
Process.waitfor (); Block until the above command finishes, be sure to close the file before closing ()
Process.getoutputstream (). Close ();
Process.getinputstream (). Close ();
Process.geterrorstream (). Close ();
}catch (Throwable e) { }} }
Troubleshooting Java using runtime.exec to perform Linux command unsuccessful issues
The key problem is waitFor (); For more explanations, see http://lelglin.iteye.com/blog/1487351
Java Linux Lame terminal execution and code execution commands generate a different file?