Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Getting current machine name

Reply
Thread Tools

Getting current machine name

 
 
Karen Jones
Guest
Posts: n/a
 
      11-23-2005
How do I get the name of the current machine in Java? I thought it would be
a system property but I can't find it.

Thanks,

Karen J.


 
Reply With Quote
 
 
 
 
hicks@bigmailbox.net
Guest
Posts: n/a
 
      11-23-2005

Karen Jones wrote:
> How do I get the name of the current machine in Java? I thought it would be
> a system property but I can't find it.
>
> Thanks,
>
> Karen J.


There may be an easier way, but this worked for me:

InetAddress addr = InetAddress.getLocalHost();
System.out.println("hostname = " + addr.getHostName());

 
Reply With Quote
 
 
 
 
Joan
Guest
Posts: n/a
 
      11-24-2005
In 1.5 you can get env variables.
For windows xp you can look up COMPUTERNAME.

"Karen Jones" <(E-Mail Removed)> wrote in message
news:438450f8$0$12463$(E-Mail Removed)...
> How do I get the name of the current machine in Java? I
> thought it would be
> a system property but I can't find it.
>
> Thanks,
>
> Karen J.
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using the current method name within current method Matthew Heidemann Ruby 14 03-22-2011 03:56 AM
Win32 install error "for a machine type other than current machine =?Utf-8?B?Sm9obiBEeWVy?= Windows 64bit 4 05-10-2007 06:04 PM
HttpContext.Current.User.Identity.Name AND Context.User.Identity.Name; nalbayo ASP .Net 2 11-11-2005 11:12 PM
Machine type other than the current machine? =?Utf-8?B?REpheS1a?= Windows 64bit 7 08-18-2005 04:00 PM



Advertisments