The pipe operator |
wont work as this is part of the command shell. Try using a shell to execute the command. Also you may want to use ProcessBuilder
for its convenience
ProcessBuilder builder =
new ProcessBuilder("bash", "-c", "dmidecode | grep UID:");
builder.redirectErrorStream(true);
Process p = builder.start();