How can I determine the IP of my router/gateway in Java? I can get my IP easily enough. I can get my internet IP using a service on a website. But how can I determine my gat
Try shelling out to traceroute if you have it.
'traceroute -m 1 www.amazon.com' will emit something like this:
traceroute to www.amazon.com (72.21.203.1), 1 hops max, 40 byte packets
1 10.0.1.1 (10.0.1.1) 0.694 ms 0.445 ms 0.398 ms
Parse the second line. Yes, it's ugly, but it'll get you going until someone posts something nicer.