Java tutorial
//package com.java2s; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static synchronized boolean isConnect(String url) { URL urlStr; HttpURLConnection connection; if (url == null || url.length() <= 0) { return false; } try { urlStr = new URL(url); connection = (HttpURLConnection) urlStr.openConnection(); int state = connection.getResponseCode(); if (state == 200) { return true; } } catch (Exception ex) { return false; } return false; } }