-
Getting Host name
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:
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! :)
-
Most likely because your method is declared static. If you take out the static keyword then you should be alright.