I\'ve been getting hostname of the machine as follows:
InetAddress.getLocalHost().getHostName();
However, when I put latest JDK (jdk1.7.0_04),
I had the same problem and when all the following lined up it worked. host name had to be appended with DOT local
$ scutil --get HostName
drums
$ scutil --get LocalHostName
drums
$ scutil --get ComputerName
drums
$ sudo hostname drums.local
$ hostname
drums.local
$sudo vim /etc/hosts
192.168.x.IP drums
127.0.0.1 localhost drums
255.255.255.255 broadcasthost
::1 localhost
fXXX::1XXX localhost
$networksetup -setv6off Ethernet
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.9
$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)