File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes nslookup in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "nslookup in Java" Watch "nslookup in Java" New topic

nslookup in Java

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 265
Dear Ranchers,
I'm doing a program in JSP and MySQL. The client is a Webhosting company. They want to check for the domain availability for registering the website thru their site.

for egs : nslookup should result the domain is available for registering
nslookup should result the domain is already registered.

Please help me to do this in Java. How can I start the coding in Java for this. Please send me some links which can help me.

Thanks in advance


Aravind Prasad
Joe Ess

Joined: Oct 29, 2001
Posts: 9188

Please do not post the same question in multiple forums. It causes confusion and duplication of effort as the community tries to help everyone.

[How To Ask Questions On JavaRanch]
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 265
Sorry for posting the doubt in different forums.
When i tried to post in the other one JSP forum it showed me it was locked, So i thought it is Java Advanced and i posted again in this forum.

Please help me, I'm waiting for Java Gurus to reply and solve my problem

Thanks and regards

Aravind Prasad
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Take a look at InetAddress.getAllByName();
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 265
Thankyou very much Scott,
I got the result using this. I've writtend a code which I'm adding here.

Now when i run the code I'm getting the output like this

Can I get the output as 1 if the domain exists..

Please help me.. what changes I should do in the code so that I can get the result like 1 if domain exists

Thanks in Advance

Aravind Prasad
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15080


Did you look at the API documentation of the method InetAddress.getAllByName(...)? If you did, you would have seen that it returns an array of InetAddress objects. If you print that directly to the screen, you'll get the above. Please read the API documentation.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: nslookup in Java
It's not a secret anymore!