try {
InetAddress inetAddress = InetAddress.getLocalHost();
strIPAddress = inetAddress.getHostAddress();
} catch (UnknownHostException e) {}
its giving correct IP address in windows but if i run the same code on linux it not giving the ip address as i got in windows
please help
Of course there is, if the user running it has "root" privileges (actually root userid or groupid if the permissions have been changed), but if you are going to do that, then why use the lookup at all, simply hardcode it in the program.
If it is because you don't know how to do it, then I would say to find someone you know who can show you how. That is infinately easier than trying to explain the structure and purpose of the hosts file to you here.