Returning if a URL exists or not?

I want to take a URL as a command line argument and return if the URL exists or not.Is there anything in java package that does this? (i.e. an exists() method)
[173 byte] By [bazwattsa] at [2007-10-3 10:38:33]
# 1
barry barry watters?yeah you create a HTTPUrlConnection and then call the response codei.eHTTPUrlConnection huc = blahdeblahint x = huc.getResponseCode(); if x is between 200 and 300 its valid
syphillaidsa at 2007-7-15 6:02:33 > top of Java-index,Core,Core APIs...
# 2

The thing is, you can determine that the site exists if you get a return code between 200 and 299, but you cannot determine that it does not exist.

If you get some other return code (even 404) it may only be a temporary error, or you may not be connected with the net, etc, etc, etc.

So, you can determine that it exists, but not that it doesn't exist. The only thing you can really say is that it is momentarily unavailable.

masijade.a at 2007-7-15 6:02:33 > top of Java-index,Core,Core APIs...