Question

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.

Was it helpful?

Solution

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/

OTHER TIPS

Another thing you can do is use the simple ping command to create your own traceroute. Traceroute is essentially sending out pings with modified TTL fields. When the ip packet reaches it's lowered TTL limit (before the destinated server) a response is sent from the server. These responses are how traceroutes are able to find how a packet gets to it's destination.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top