This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes General Computing and the fly likes Query regarding hosts file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Query regarding hosts file." Watch "Query regarding hosts file." New topic

Query regarding hosts file.

Ajith George
Ranch Hand

Joined: Dec 22, 2005
Posts: 109
I have 2 tomcats running on my machine. Both on different ports, one on 80 and other on 8086. I want to have a host entry on my hosts file so that i can have a name for the instance running on port 8086. i put entry but it's not working for port 8086.For port 80 it's working.

IS it possible for us to specify port addres also with ip on hosts file? if possible how?

Plese help me

SCJP 1.4, Brainbench
LinkedIn - Blog
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Good question. So I googled "hosts file format" and looked at the first link it returned. It says:

"Entries in the hosts file have the following format:

Address HostName"

There you are. Nothing about ports.

Anyway that would only affect the behaviour of your machine. Hardly worth providing a second name for localhost just to avoid typing ":8086" once in your browser, don't you think?
Ajith George
Ranch Hand

Joined: Dec 22, 2005
Posts: 109
Actualy the requirement is not just to avoid typing 8086. My hosted site is crashing at one point because of this 8086. ie the system is not taking the port 8086 on that point. But it's working well on default port ie on 80. So i thought, i can avoid this crash my providing a host entry with port.
jQuery in Action, 2nd edition
subject: Query regarding hosts file.
Similar Threads
How do I disable port 80 for certain URLs
how to map to http://localhost:8080/test/index.jsp on Tomcat server
What will be the URL to my Java Application ?
Tomcat service on different ports
Accessing Tomcat using etc\host