Here you can find the source of urlExists(String urlString)
public static boolean urlExists(String urlString)
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; public class Main { public static boolean urlExists(String urlString) { InputStream is = null;//from w w w. ja v a2 s .c o m try { URL url = new URL(urlString); URLConnection con = url.openConnection(); is = con.getInputStream(); return true; } catch (Exception e) { return false; } finally { if (is != null) { try { is.close(); } catch (IOException e) { } } } } }