Search code examples
servletsbrowserlocalhostsystemhost

How to change the hostname "localhost" in Windows OS?


I am trying to change the hostname from "localhost" to "systemhost" (user-defined names).

I was actually running a servlet program where I suddenly got a question, if it is possible to change the hostname from localhost (default) to systemhost (user-defined)

What I have done so far:

  • Searched on the google but I get irrelevant answers.
  • Changed the server.xml file content from localhost to systemhost as I was running servlet program so I thought that this change can work along.

enter image description here

  • Navigated to C:\Windows\System32\drivers\etc and changed the hosts file. Replaced the word localhost to systemhost.

enter image description here

After doing all these no success. I wonder, if it is really possible to change?


Any help or suggestions?

Thanks!


Solution

  • uncomment that line by removing #. it should be:

    127.0.0.1 systemhost
    ::1 systemhost