| | |
Retrieving Computer Name
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
hey guys,
I was wondering if there is anyway that my java app could retrieve the computer name.
IE
My computer could be named
I want to retreive
Thanks PO.
I was wondering if there is anyway that my java app could retrieve the computer name.
IE
My computer could be named
"PhiberOptik-desktop" I want to retreive
"PhiberOptik-desktop" !Thanks PO.
History will be kind to me for I intend to write it.
---------------------------------- Sir Winston Churchill
---------------------------------- Sir Winston Churchill
Nevermind Figured it out!
java Syntax (Toggle Plain Text)
import java.net.*; class myName { public static void main (String args[]) { try { InetAddress address = InetAddress.getLocalHost(); System.out.println("Hello. My name is " + address.getHostName()); } catch (UnknownHostException e) { System.out.println("I'm sorry. I don't know my own name."); } } }
History will be kind to me for I intend to write it.
---------------------------------- Sir Winston Churchill
---------------------------------- Sir Winston Churchill
![]() |
Similar Threads
- How To Save in our Computer (Perl)
- C++ computer memory access (C++)
- Storing and Retrieving Number String/Array (PHP)
- Retrieving data from a HDD (Storage)
- Help!! Applet only works in AppletViewer but not in html file with <applet> tags!!! (Java)
- Data Error: cyclic redundancy check (Windows 95 / 98 / Me)
- Retrieving data from old hard drive (Storage)
Other Threads in the Java Forum
- Previous Thread: IEEE format to decimal conversion
- Next Thread: java vs .net
| Thread Tools | Search this Thread |
actuate android api applet application applications array arrays automation balls bank binary bluetooth business chat class classes clear client code codesnippet collections component database defaultmethod development dice dragging ebook eclipse error event exception formatingtextintooltipjava fractal froglogic game givemetehcodez graphics gui hql html ide image infinite input integer intersect invokingapacheantprogrammatically j2me java javaprojects jni jpanel julia linux list loop looping map method methods mobile mysql netbeans newbie numbers openjavafx parameter php print problem program programming project recursion repositories scanner screen scrollbar server set size sms sort sorting sql sqlserver state storm string sun superclass swing swt text-file threads time tree windows





