PDA

Click to See Complete Forum and Search --> : Getting Host name


MethadoneBoy
Feb 22nd, 2002, 04:34 AM
I'm using the import java.net.*; package to determine the name of the machine I'm using (I need it to set up a socket).

Here is my code:

private static String GetHost () throws IOException {

String MailHost;
MailHost = InetAddress.getHostName ();//.getLocalHost(). getHostAddress ();
return MailHost;

}

When this compiles I get a non-static context error. How can I fix this?

Mach appreciated! :)

Dillinger4
Feb 22nd, 2002, 01:14 PM
Most likely because your method is declared static. If you take out the static keyword then you should be alright.