Here you can find the source of isUrlReachable(String url)
public static boolean isUrlReachable(String url)
//package com.java2s; /*// w ww . java 2s.com * Copyright (c) Bosch Software Innovations GmbH 2016. * With modifications by Siemens AG, 2016. * Part of the SW360 Portal Project. * * SPDX-License-Identifier: EPL-1.0 * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ import java.io.IOException; import java.net.URL; import java.net.URLConnection; public class Main { private static final int CONNECT_TIMEOUT = 10000; public static boolean isUrlReachable(String url) { try { final URLConnection connection = new URL(url).openConnection(); connection.setConnectTimeout(CONNECT_TIMEOUT); connection.connect(); return true; } catch (final IOException e) { return false; } } }