How to get system Hostname in java

Hi,

I am a java developer trying to get the hostname of the system from java class. Meaning want the value when i run the $hostname command in linux and my server is Linux server.

I am searching in the System Properties for the hostname but i could not get it

I am running IBM Websphere 5.2 and JDK 1.4.2 in my linux server.

Thanks for input

-AP

[383 byte] By [AskPeersa] at [2007-11-26 18:21:45]
# 1
try here: http://www.google.ca/search?hl=en&q=java+%2Bhostname&btnG=Google+Search&meta=
Aknibbsa at 2007-7-9 5:55:38 > top of Java-index,Java Essentials,Java Programming...
# 2

Try

package testing;

import java.net.*;

public class Test

{

public static void main(String[] args) throws UnknownHostException

{

System.out.println(InetAddress.getLocalHost().getHostName());

}

}

duckbilla at 2007-7-9 5:55:38 > top of Java-index,Java Essentials,Java Programming...
# 3
Thanks a lot ..
AskPeersa at 2007-7-9 5:55:38 > top of Java-index,Java Essentials,Java Programming...