import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.util.Calendar; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.UIManager; /** * Continuously monitors the internet connection once a minute. Once it detects that the * internet is down, then it will shut down the computer. * @author Jia * */ public class InternetConnectionChecker { String [] urls = { "http://www.yahoo.com/", "http://www.google.com/", "http://www.aol.com/" }; String[] commands = {"cmd /c shutdown.exe -t 00 -s -f"}; public InternetConnectionChecker()throws Exception{ File f = new File("C:\\Internet Log.txt"); BufferedWriter bw; if (!f.exists()) f.createNewFile(); boolean connected = false; boolean append = true; FileWriter fw = new FileWriter(f, append); for (int i=0; i