how to run traceroute command through your application?

Raga picture Raga · Oct 31, 2012 · Viewed 21.1k times · Source

I want to run traceroute command through my application.
How do I do this?

Runtime.getRuntime().exec("traceroute google.com")

not working.

java.io.IOException: Error running exec(). Command: [traceroute, -4, google.com] Working Directory: null Environment: null 11-02 12:51:38.399: E/trace(1604): at java.lang.ProcessManager.exec(ProcessManager.java:224)

Is there another way like using NDK or else.
Please help me out.

Answer

darshanz picture darshanz · Oct 31, 2012

You can not use use traceroute command in Android.

If you want to use it in a rooted device with busybox installed, use path of the busybox installation to run the command. thi library can be useful if you want to use it in rooted devices. http://code.google.com/p/roottools/