Thanks Maulin, I had heard that it is best to avoid using runtime exec, is this right? Would there be a way to do a nslookup internally from within java?
Joined: Nov 04, 2001
hi Peter, well, if v use Runtime.exec() in a manner that is hazardous then YES. it is not recommended. by hazardous i would mean, if we use absolute paths which are system dependent (like the one i use in the first commented invocation of the exec() having /usr/sbin/nslookup. in this case it is no longer system independent as it will only work on Unix/Linux where we have nslookup on /usr/sbin/ (well thats the case most of the time though)... otherwise i really don see a whole lot of problems w/ it in comparision of efforts we will have to put in implementing RFC1739 u can probably find impl in java by googling on "nslookup in java" or something.... anybody else has more views on this? regards maulin
I believe the class java.net.InetAddress is what you're looking for. Depending on what you want to do, you can construct one using a dotted-quartet address and then ask the InetAddress for the host name, or vice versa.