Search code examples
javacross-platformhosts-file

Getting hosts file location in Java


How can I get the location of the hosts file when using my application on different platforms?


Solution

  • think that you would have to roll your own here I'm afraid, as this is a pretty low level system function, I think that it's a little beyond what you could expect java to do for you.

    This link points to some special options that you can set to alter the bind order, I don't think that they will tell you where the hosts file is, but you could could investigate in and around these options to see if you can find anything else to help you