Here you can find the source of isURL(String str)
public static boolean isURL(String str)
//package com.java2s; /* J_LZ_COPYRIGHT_BEGIN ******************************************************* * Copyright 2001-2004, 2010-2011 Laszlo Systems, Inc. All Rights Reserved. * * Use is subject to license terms. * * J_LZ_COPYRIGHT_END *********************************************************/ public class Main { public static boolean isURL(String str) { // when running in ant, some of these protocols (https and soap, at // least) throw MalformedURLException if (str.startsWith("http:") || str.startsWith("https:") || str.startsWith("file:") || str.startsWith("ftp:") || str.startsWith("soap:")) { return true; }/*from w w w . j a va 2s . c om*/ try { new java.net.URL(str); // for effect return true; } catch (java.net.MalformedURLException e) { return false; } } }