Here you can find the source of isUrlExists(String url)
public static boolean isUrlExists(String url)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static boolean isUrlExists(String url) { try {/*w w w. j a v a 2 s .c o m*/ URL urlObject = new URL(url); HttpURLConnection huc = (HttpURLConnection) urlObject .openConnection(); huc.setRequestMethod("HEAD"); huc.connect(); return huc.getResponseCode() == 200; } catch (IOException ignored) { } return false; } }