First of all, create a string array with the elements of a browser exe path
and the file you desire to open in your browser. Next, create an instance of
Runtime class and invoke exec methods to execute the browser exe. This
returns a Process object.

Here is sample code:

public class opening
{
  public static void main(String args[])
  {
    try
    {
      Runtime rt=Runtime.getRuntime();
      String
str[]={"c:\\progra~1\\intern~1\\iexplore.exe",
"c:/basha/index.html"};

      Process p=rt.exec(str);
    }
    catch(Exception e)
    {System.out.println(e);}
  }
}


Regards,
Vikramjit Singh,
GTL Ltd.
Ph. 7612929-1059



> -----Original Message-----
> From: Deepak Rustagi [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 13, 2002 9:32 PM
> To: [EMAIL PROTECTED]
> Subject: opening IE through java program
>
>
> hi,
>
> I have the requirement to open explorer with URL through java program
> running at client side and once user finishes the work the
> browser will automatically closed also.
>
> Same like u can open notepad through Process object and close also, I
> want to open explorer and close it also.
>
> Kindly tell whether this is possible.
>
> Thanks & Regards
> deepak rustagi
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to