Here you can find the source of isAv(JFrame frame)
public static boolean isAv(JFrame frame)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import javax.swing.*; public class Main { public static final String ROOT = "http://192.168.1.33:8080/"; public static boolean isAv(JFrame frame) { //Try to access the server try {// w w w . jav a 2s . c o m final URL url = new URL(ROOT); final URLConnection con = url.openConnection(); con.connect(); } catch (MalformedURLException e) { JOptionPane.showMessageDialog(frame, "Check Internet Connection"); } catch (IOException ex) { JOptionPane.showMessageDialog(frame, "Check Internet Connection"); return false; } return true; } }