InetAddress.getLocalHost().getHostAddress() returns loopback on server?

I'm trying to create a script to test server availability. In the response I would like to return the IP of the server. The following works fine locally but when I run it online it just gives me the loopback address.

InetAddress.getLocalHost().getHostAddress();

Granted the server is a shared box but shouldn't I still be able to determine the associated IP?

Josh

[390 byte] By [CrystalDragona] at [2007-11-27 10:08:02]
# 1
This is a misconfiguration of your DNS or your /etc/hosts file. It is very common in Linux distributions. Ensure that 'localhost' is associated with 127.0.0.1 and that your real hostname is associated with your public IP address.
ejpa at 2007-7-13 0:44:25 > top of Java-index,Core,Core APIs...