How to make java.net use host file?
843790Aug 31 2006 — edited Sep 4 2006Hello.
I have an app on one machine (call it local) that tries to connect to another server (call it remote) using java.net, specifically creating a new URL object passing it the host name, port and protocol. I have defined the host name 'remote' in my host file, but we also have another machine with this same name in DNS.
We want to connect to the machine defined in the host file. But when I execute the code and print out the ip address of the host, it's giving me the ip of the machine in DNS.
How can I make it consult the host file first? I thought this was standard behavior. When we do a 'ping' to 'remote' from 'local', it returns the correct ip, the one in our host file. But java.net seems not to use the host file ...
Is this possible?
Thanks,
Bob