java - getRuntime with pipe? -
i want execute following command in java program. execute first part. part after | not executed
process process = runtime.getruntime().exec(" adb devices | tail -n +2 | cut -sf 1"); process.waitfor();
you need run in shell. try this:
process process = runtime.getruntime().exec(new string[] { "/bin/sh", "-c", "adb devices | tail -n +2 | cut -sf 1" }); process.waitfor();
Comments
Post a Comment