0

I can't run strace command from my java application .

I tried the code above

try {
    // Executes the command.
    java.lang.Process process = Runtime.getRuntime().exec("strace -p 2545 -o /mnt/sdcard/Result.txt");

    BufferedReader reader = new BufferedReader(
            new InputStreamReader(process.getInputStream()));
    int read;
    char[] buffer = new char[4096];
    StringBuffer output = new StringBuffer();
    while ((read = reader.read(buffer)) > 0) {
        output.append(buffer, 0, read);
    }
    reader.close();

    // Waits for the command to finish.
    process.waitFor();

    output.toString() ;
} catch (IOException e) {
    throw new RuntimeException(e);
} catch (InterruptedException e) {
    throw new RuntimeException(e);
}

Can I have your help please ? my android version is 2.2 and my kernel version is 2.6.32.9

Edward Falk
  • 9,991
  • 11
  • 77
  • 112
Jane1310
  • 1
  • 1

0 Answers0