title: InetAddress.getLocalHost() throws UnknownHostException
body: <p>I am testing our server-application (written Java) on different operating systems and thought that OpenSolaris (2008.11) would be the least troublesome due to the nice Java integration. Turns out I was wrong, as I end up with a UnknownHostException</p>
  
  <pre><code>try {
    computerName = InetAddress.getLocalHost().getHostName();
    if (computerName.indexOf(".") &gt; -1)
      computerName = computerName.substring(0,
          computerName.indexOf(".")).toUpperCase();
  } catch (UnknownHostException e) {
    e.printStackTrace();
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>java.net.UnknownHostException: desvearth01: desvearth01
      at java.net.InetAddress.getLocalHost(InetAddress.java:1353)
  </code></pre>
  
  <p>However, <code>nslookup desvearth01</code> returns the correct IP address, and <code>nslookup localhost</code> returns <code>127.0.0.1</code> as expected. Also, the same code works perfectly on FreeBSD. Is there anything special to OpenSolaris that I am not aware of?</p>
  
  <p>Any hints appreciated, thanks.</p>