Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find the computer name

Status
Not open for further replies.

skarosi

Programmer
Jan 25, 2004
140
GR
Dear all,
I need to obdain the name of a machine and save it as a String.
is there a command in Java that would do it automatically?
if not, is there any command for unix and windows, that would print the name in a command prompt/terminal?
thanks
 
Code:
String host = "";
try {
	host = java.net.InetAddress.getLocalHost().getHostName();
} catch (Exception e) {
        // handle error
}

--------------------------------------------------
Free Database Connection Pooling Software
 
thanks man! that was great and fast;)
cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top