View Single Post
  #1 (permalink)  
Old 07-14-2007, 02:17 PM
AdnanAhsan
Posts: n/a
Icon13 [SOLVED] Detect LocalHost Name And IP Address..

This is my first tutorial at this forum, here i am showing you how to detect localhost name and local ip address

import java.net.*;

class Information
{
public static void main(String [] aa)

{
try{

System.out.println(InetAddress.getLocalHost().getH ostName());
System.out.println(InetAddress.getLocalHost().getH ostAddress());


}catch(Exception e){}

}

}


compile it with save and compile it

compile as follows:
javac Information.java

Run as follows:

java Information

note: If you face any problem please let me know...

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!