The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


IP Address

Posted by Vijay Padmanabhan on September 05, 2000 at 4:29 PM

> I am writing a Bean, to be integrated into an installation s/w
> that will need to determine the IP address of the Machine/ System
> on which this software will be run. What is the best way to determine
> IP address.


Actually you can make use of the package for this.
The code snipplet will be like this.

InetAddress ia = InetAddress.getLocalHost();
String ipAddress = ia.getHostAddress();

This returns a String which has an dotted IP Address representation.


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us