Here is what I wrote today to βimplementβ the route trace command in Java. I tested only on Windows, but it should also work on Linux, although several traceroute tools are available for Linux, so most likely you need some checks for these programs.
public class NetworkDiagnostics{ private final String os = System.getProperty("os.name").toLowerCase(); public String traceRoute(InetAddress address){ String route = ""; try { Process traceRt; if(os.contains("win")) traceRt = Runtime.getRuntime().exec("tracert " + address.getHostAddress()); else traceRt = Runtime.getRuntime().exec("traceroute " + address.getHostAddress());
carlin.scott
source share