Microsoft KB Archive/252030

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 13:51, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Article ID: 252030

Article Last Modified on 6/14/2006


  • Microsoft Java Virtual Machine

This article was previously published under Q252030


This article describes how to invoke Microsoft Internet Explorer from Java and navigate to a URL.


Steps to Invoke Internet Explorer

  1. In Microsoft Visual J++ 6.0, create a new empty project.
  2. Add a new class to the project named
  3. Paste the following code into the file:

       import shdocvw.*;
       public class Navigate
          IWebBrowserApp testBrowser = null;
          public static void main( String args[] )
              IWebBrowser2 testBrowser = (IWebBrowser2)new InternetExplorer();
              Variant var = new Variant();
              testBrowser.Navigate("",var,var, var, var);
  4. Click Project, and then click Add COM Wrapper to add the Component Object Model (COM) wrappers for the Microsoft Internet Controls (Shdocvw.dll).
  5. Compile and test the new project.

NOTE: The IWebBrowser2 interface replaces the IWebBrowserApp and IWebBrowser interfaces.

NOTE: In this example, the last four parameters of the Navigate method are optional. As a result, we create a Variant and call its putEmpty() method to act as the arguments that we are not supplying.


For information about the IWebBrowser2 interface, see the following article on the Microsoft Developer Network (MSDN):

For information about the IWebBrowser2::Navigate method, see the following MSDN article:

For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Keywords: kbhowto kbjava KB252030