Getting hostname with java fails in latest jdk7
<p>I've been getting hostname of the machine as follows: </p>

<pre><code>InetAddress.getLocalHost().getHostName();
</code></pre>

<p>However, when I put latest JDK (jdk1.7.0_04), the code above simply return LOCALHOST. I checked /etc/hosts (its linux) and it says there:</p>

<pre><code>127.0.0.1    localhost    redbull
</code></pre>

<p>It's been returning REDBULL until upgrade. So I changed that around putting</p>

<pre><code>127.0.0.1    redbull    localhost
</code></pre>

<p>instead and it started returning REDBULL without a problem.</p>

<p>Is there a better way of making this work?</p>
