The Artima Developer Community
Sponsored Link

Java Answers Forum
Computer Name using Java

1 reply on 1 page. Most recent reply: Mar 5, 2002 10:16 AM by Bruno Baguette

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Raj

Posts: 4
Nickname: raj
Registered: Feb, 2002

Computer Name using Java Posted: Feb 28, 2002 5:25 PM
Reply to this message Reply
Advertisement
I would like to find a way in which i can get hold of the computer name using java.


Bruno Baguette

Posts: 3
Nickname: bouchon
Registered: Mar, 2002

Re: Computer Name using Java Posted: Mar 5, 2002 10:16 AM
Reply to this message Reply
> I would like to find a way in which i can get hold of
> the computer name using java.

Hello,

If you intend to get the computer name on a Microsoft operating system, i think that's a bad idea because i think (i'm maybe wrong) that will not work on other operating systems.

You should try to get the computers name using that piece of code (which is portable on others OS) :

import java.net.InetAddress;
 
// Get machine name
string machine;
InetAddress MyInetAddress = MyInetAddress.getLocalHost();
machine = MyInetAddress.getHostName();
System.out.println("This computer is named : " + machine);


Note that i didn't try that code, it may have some little compilation errors !

Hope this help ! :-)

Flat View: This topic has 1 reply on 1 page
Topic: MD5 password encryption like Linux Previous Topic   Next Topic Topic: Please Kishori Help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use