File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 19973

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.
I agree. Here's the link:
subject: Query regarding hosts file.
It's not a secret anymore!