Java code: Open IE browser and close it

I want to refresh my blog on Sohu to increase the visitor count. The following is the code for open IE browser and then close it. This will be done every 5 seconds, and in one day the count should be able to increase 3600*24/5 = 17280. So if you open your computer 10 days,  the count will become 172800. That will be a nice number.

Here is the Java code to open and close IE:

public class OpenClose {
	public static void main(String[] args) {
		while(true){
			try {
				Process p = Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe \"http://www.google.com\"");
				Thread.sleep(5000);
				p.destroy();
				System.out.println("Return value was " + p.waitFor());
			} catch (Exception e) {}
		}
	}
}

4 thoughts on “Java code: Open IE browser and close it”

  1. Hi. I tried the above code. Its working but I dnt want to open the browser every 5 sec now. so how do I stop running the code?

Leave a Comment