• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

nslookup

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone know please how to call an nslookup from within java to test if a domain name exists?
many thanks
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how about,

regards
maulin
 
Peter Straw
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Peter Straw
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou both, that's what was needed
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks "Ernest Friedman-Hill"!
i liked ur idea.
regards
maulin
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic