public static String getHostName()
{
String hostName = "";
try
{
InputStream is = Runtime.getRuntime().exec("hostname").getInputStream();
byte[] file = new byte[50];
while (is.read(file) != -1)
{
hostName += (new String(file)).trim();
}
}
catch (IOException e)
{
e.printStackTrace();
// logger.error(e);
}
return hostName;
}
{
String hostName = "";
try
{
InputStream is = Runtime.getRuntime().exec("hostname").getInputStream();
byte[] file = new byte[50];
while (is.read(file) != -1)
{
hostName += (new String(file)).trim();
}
}
catch (IOException e)
{
e.printStackTrace();
// logger.error(e);
}
return hostName;
}