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) {
			try {
				Process p = Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe \"\"");
				System.out.println("Return value was " + p.waitFor());
			} catch (Exception e) {}
Category >> Real Methods  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
String foo = "bar";
  • Ankita

    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?

  • pranish shrestha

    how to use Desktop class to open the default browser and close it??

  • rohit

    it’s not working p.destroy();

  • mohit

    Exception is coming how to remove this… runtime exception are coming