In Java I’m trying to verify that a URL exists. I do this by creating a URL object, then calling URL.openConnection, then calling URLConnection.connect(), then calling URL.openStream(). None of these throw an exception with this URL: “http://”, which makes no sense.
I need the method to be protocol independent.
Get the response code:
If it doesn’t throw an exception, the URL exists. This one threw
for me.