How to use JVM Parameters to change mappings of hostname and IP?

OS: Linux

I do not have root account, and my account is not permitted to modify /etc/hosts. But I want to use particular mappings of hostname and IP, can I write a .txt file similiar to /etc/hosts containing my mappings and use JVM parameters to make JVM to look up my file instead of /etc/hosts?

[309 byte] By [machINea] at [2007-10-3 7:57:20]
# 1

It sounds like you are trying to work around an incorrect entry in /etc/hosts - is that right? By default, InetAddress will use the platform's name service. This means it will do the lookup via /etc/hosts, nis, dns, ldap or whatever/however it is configured in /etc/nswitch.conf. I'm not aware of any way to configure a "private" hosts file.

If your issue is that an entry in /etc/hosts is invalid and if the entry is correct in DNS then one possible workaround is to define the system property sun.net.spi.nameservice.provider.1 to "dns,sun". This will cause InetAddress to use a DNS name service provider. If /etc/resolv.conf is correctly configured then it should just work. If DNS is not configured then you'll need to set the sun.net.spi.nameservice.nameservers property with the IP addresses of the DNS servers.

I hope this helps but the right solution, and you probably know, is to get the hosts file configured correctly.

alan.batemana at 2007-7-15 3:00:13 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
Thank you very much. I am using a Grid Middleware Java library and I hava found a property of the middleware to make JVM use IP address instead of hostname.
machINea at 2007-7-15 3:00:13 > top of Java-index,Java HotSpot Virtual Machine,Specifications...