This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Displaying current host IP Address? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Displaying current host IP Address?" Watch "Displaying current host IP Address?" New topic
Author

Displaying current host IP Address?

Sloan Bowman
Ranch Hand

Joined: Jan 21, 2003
Posts: 107
I was wondering how you could use the java.net.Inet4Address package to display the local computers ip address. When calling the method getAddress() I get the error message stating cannot be accessed by outside package? Any help would be great. Thanks
Neil Laurance
Ranch Hand

Joined: Jul 18, 2002
Posts: 183
With the old package, you would do:

I don't have Java 1.4, but I guess you would just need to do:

Hope this helps? :roll:
Sloan Bowman
Ranch Hand

Joined: Jan 21, 2003
Posts: 107
I really appreciate your help. I haven't working much with the java.net.* package so I was unfamiliar with how it was called. Thanks again!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying current host IP Address?
 
Similar Threads
Connect to DB in Anthor PC
how many internet devices do you have?
Is it possible to store persistence.xml outside JAR-file?
Getting CommunicationException
Way to get IP address through Java?