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.
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.
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).