0

Hi,

I have opened Internet Explorer by using
Process p = Runtime.getRuntime().exec(browserCommand+" " +url_name);

Now I want to know how to close opened internet explorer using java program

I used p.destroy() method, but it's not working.

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Ezzaral
0

Hi,

I have opened Internet Explorer by using
Process p = Runtime.getRuntime().exec(browserCommand+" " +url_name);

Now I want to know how to close opened internet explorer using java program

I used p.destroy() method, but it's not working.

Hye HI,

Try this one:

String URL="http://www.google.com";
com.ice.jni.registry.ApplicationStarter.start(URL)

OR

If you specifically want to open IE then use JACOB
http://danadler.com/jacob/
--

import com.jacob.com.*;
import com.jacob.activeX.*;
import java.util.*;
 
class IExplorer
{
myIE IE;
 static 
  {
    System.loadLibrary("jacob");
  }
	public static void main(String[] args)
	{
              new IExplorer();
	}//main
 
	IExplorer()
	{
	 try{
		 IE=new myIE();
		 IE.Navigate("http://www.google.com" );
		 IE.Visible(true);
                      }
	catch (Exception e)
	    {
                            e.printStackTrace();
                            System.out.println("Error "+e);
                    }
 
        }//IExplorer
   class myIE extends Dispatch
	{
        public myIE()
		{
            super("InternetExplorer.Application");
		}
		public void Navigate(String url)
		{
			   Variant V[]=new Variant[1];
			   V[0]=new Variant(url);
                                  Dispatch.callN(this, "Navigate",V);
 
		}
		public void Visible(boolean value)
		{
         	   Dispatch.put(this, "Visible", new Variant(value));
		}
 
	}//myIE
 
 
}

tried hard to align but give up

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.