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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.