Possible Duplicate:
How to check if internet connection is present in java?
I have a java desktop app which connects to a online document. Now how can I determine whether the user is connected to internet or not.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try retrieving something from the internet. Like the document. Or google. Or ping something.
You might want to set a reasonable timeout, or do the check in a background thread on startup (although the connectivity may change, it can be nice to show a little “Connected” icon or something).