Created
June 19, 2014 23:19
-
-
Save arunreddy/27c6d68af7a48454f4a9 to your computer and use it in GitHub Desktop.
Execute command in java.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.executeCommand("SMILExtract -C /media/MEDIA02/msthesis/emobase2010.conf -I example_audio1.wav -O targetFile.arff -label1 ); | |
public static String executeCommand(String command) { | |
StringBuffer output = new StringBuffer(); | |
Process p; | |
try { | |
p = Runtime.getRuntime().exec(command); | |
p.waitFor(); | |
BufferedReader reader | |
= new BufferedReader(new InputStreamReader(p.getInputStream())); | |
String line = ""; | |
while ((line = reader.readLine()) != null) { | |
output.append(line + "\n"); | |
} | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
return output.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment