Accessing Internet Explorer (IE) from Java

Java/J2EE COM Interoperability Products Page

This example demonstrates how to access Internet Explorer (IE) from Java. J-Integra® for COM is a Java interoperability component that bridges Java and Internet Explorer (IE). It provides bi-directional access of Java objects and COM components.

We do not provide the documentation of the generated Java proxies since the Java proxies are just mapped from the programming API of the COM component. For more information about Internet Explorer programming, please refer to the Internet Explorer VB Reference.

This example is for IE 5.x. If you use a different version of IE, you need to look at the generated Java proxies and Internet Explorer programming API to call the methods accordingly.

Refer to the Excel example for details of steps.

/* This is an example of using J-Integra® to interface to Microsoft's Internet Explorer 5.x
 * The program starts up an explorer application and registers an event listener which then
 * proceeds to record web navigations until the explorer window is closed. The java code
 * then also finishes.
 * To run this example, create an 'ie' subdirectory, and run J-Integra®'s 'com2java'
 * tool, specifying the Internet Explorer type library (shdocvw.dll from the windows SYSTEM
 * directory - e.g. c:\WINNT\System or c:\WINDOWS\system32) as the input type library,
 * 'ie' as the package name, and the ie subdirectory you created as the output directory.
 * This Java client will run on any machine which has a standard JVM, such as a UNIX machine.

import ie.*;

public class IeExample {

  public static void main(java.lang.String[] args) throws Exception {
    try {
      WebBrowserListener listener = new WebBrowserListener();

      // If running this Java client under MS windows then make sure the J-Integra® 'bin' directory
      // is in your PATH, otherwise run DCOMCNFG on the machine running IE (Start|Run|DCOMCNFG),
      // grant a specific user default launch and access permissions, and uncomment the following
      // line, specifying the appropriate domain/user/password
      // com.linar.jintegra.AuthInfo.setDefault("NT DOMAIN", "NT USER", "NT PASSWORD");

      // If talking to a Windows 95/98 machine, Internet Explorer must already be running.
      // Specify remote host name as a parameter if you want to access Internet Explorer remotely.
      InternetExplorer explorer = new InternetExplorer();

      explorer.navigate2("", null, null, null, null);

      synchronized (listener) {


    } finally {
      // Release all remote objects that haven't already been garbage collected.

class WebBrowserListener extends DWebBrowserEvents2Adapter {

  public void beforeNavigate2(DWebBrowserEvents2BeforeNavigate2Event theEvent)
    throws, com.linar.jintegra.AutomationException {
    System.out.println("Navigating to " + theEvent.getURL());

  public void navigateComplete2(DWebBrowserEvents2NavigateComplete2Event theEvent)
    throws, com.linar.jintegra.AutomationException {
    System.out.println("Navigation complete " + theEvent.getURL());

  public void onQuit(DWebBrowserEvents2OnQuitEvent theEvent) {
    synchronized (this) {