Skip to content

Instantly share code, notes, and snippets.

@arunreddy
Created June 19, 2014 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arunreddy/27c6d68af7a48454f4a9 to your computer and use it in GitHub Desktop.
Save arunreddy/27c6d68af7a48454f4a9 to your computer and use it in GitHub Desktop.
Execute command in java.
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