title: Inetaddress.getLocalHost() UnknownHostException Windows 8
body: <p>I am attempting to use Elastic Search in a Spring program. Currently I am trying to create a Transport Client as per <a href="https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.1/transport-client.html" rel="nofollow noreferrer">this guide</a>. Unfortunately the <code>InetAddress.getByName("localhost")</code> is giving me an </p>
  
  <blockquote>
    <p>unhandled exception type UnknownHostException</p>
  </blockquote>
  
  <p>I have also tried using <code>InetAddress.getLocalHost()</code> and have received the same error.</p>
  
  <p>I am on a Windows 8 machine and I have changed my host file as detailed in <a href="https://stackoverflow.com/questions/1881546/inetaddress-getlocalhost-throws-unknownhostexception">this answer</a>. If anyone has any ideas please let me know. Thank you.</p>