title: How to do a true Java ping from Windows?
body: <p>I have a device on a network that I am attempting to ping through my Java program. Through my windows command prompt, I can ping the device address fine and do a tracert on the address fine.</p>
  
  <p>Online, I have seen that in order to do a ping through Java you have to do the following:</p>
  
  <pre><code>InetAddress.getByName(address).isReachable(timeout);
  </code></pre>
  
  <p>But, when I use this code on my device address, it always returns false in my program. I am using the correct IPv4 address with a good timeout value. Also, if I use a localhost address, it works fine.</p>
  
  <p>Why can I ping the device through cmd, but not through my program? I have heard in various places that this is not a <em>true</em> ping.</p>
  
  <p>Is there a better way to emulate a ping in Java?</p>
  
  <p>Thanks</p>