title: Java get local IP
body: <p>Im trying to get the local IP. It should work with</p>
  
  <pre><code>System.out.println(Inet4Address.getLocalHost().getHostAddress());
  </code></pre>
  
  <p>or </p>
  
  <pre><code>InetAddress addr = InetAddress.getLocalHost();
  ip = addr.getHostAddress();
  System.out.println("Ip: " + ip);
  </code></pre>
  
  <p>but it always returns <code>192.168.178.154</code> instead of <code>192.168.178.119</code>(This is my real local IP(Terminal --> <code>ifconfig</code>))</p>
  
  <p>What should I do?</p>