PRB: Unable to Deploy an ActiveX Control Created Using Visual J++ 6.0

ID: Q214647


The information in this article applies to:
  • Microsoft Visual J++, version 6.0
  • Microsoft virtual machine


SYMPTOMS

An ActiveX control created using Visual J++ 6.0 fails to load inside the browser when deployed to a client machine or on a Web server.


CAUSE

The following is a checklist that outlines the cause of this problem:

  • Your ActiveX control project is not packaged into a COM DLL.


  • The client machine is running a build of Microsoft virtual machine that is earlier than 2922. Only Microsoft VM builds 2922 and greater support the Windows Foundation Classes for Java (WFC).


  • The machine has a duplicate version of the same ActiveX control in a different directory.



RESOLUTION

A work around is available. See the "More Information" section later in this article for details.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Create the ActiveX control as follows using Visual J++ 6.0:
    • From the File menu, click New Project.


    • On the New tab, expand the Visual J++ Projects folder and click Components. Click the Control icon.


    • In the Name box, enter a name for your project.


    • In the Location box, enter the path where you want to save your project, or click Browse to navigate to the folder.


    • Click Open. A collapsed view of your project appears in Project Explorer.


    • In Project Explorer, expand the project node. A file with the default name of Control1.java has been added to your project.




  2. Use the following steps to expose this control as an ActiveX control:
    • On the Project menu, click Project Properties to bring up the Project Properties dialog box.


    • Select the COM Classes tab in the Project Properties dialog box.


    • In the COM Classes tab, click Automatically generate Type Library.


    • Select the class you wish to make a COM class.


    • By default, Visual J++ creates a type library file based on the name of the project.




  3. Modify your new Control and add it to a new form.
    • Open your control in Forms Designer and add an EditBox and Button control to it.


    • Find the click event on your Button control and and enter OnClick for the name of the method that will handle the event. When you press ENTER, the Text editor opens to an empty event handler named OnClick.


    • Include the following to the event handler:
      
      private void OnClick(Object source, Event e)
      {
         edit1.setText("This is a test");
      } 


    • Build the control.


    • To add the control to the ToolBox, click the Tools menu, and select Customize ToolBox.


    • Add a Form to your project.


    • Add the control to your Form.


    • Build and Run the Form.




  4. Package your Control Project into a Cab Archive as follows:
    • On the Project menu, click Project Properties to open the Project Properties dialog box.


    • Select the Output Format tab.


    • Select Enable Packaging and select Cab Archive(.CAB) as the packaging type.




  5. Rebuild your Control Project.


  6. Create an HTML file as follows that references your control and the CAB file:
    
       <HTML>
       <HEAD>	
       <TITLE>
    	Deploy WFC ActiveX Control
       </TITLE>
       </HEAD>
       <BODY>
       <OBJECT id="JavaCtl"
        classid="CLSID:5D178FF9-AF1B-11D2-BAEE-0000F87A47A8"
        codeBase="JavaCtl.CAB#version=1,0,0,1">
       </OBJECT>
       </BODY>
       </HTML> 


  7. Launch the HTML file.


  8. This opens the Signing Certificate, but fails to load your ActiveX control.


Workaround

Replace steps 4-8 with the following:
  1. Package your Control Project into a COM DLL as follows:
    • On the Project menu, click Project Properties to open the Project Properties dialog box.


    • Select the Output Format tab.


    • Select Enable Packaging and select COM DLL as the packaging type.




  2. Rebuild your Control Project.


  3. Create another new Project.
    • Select Visual Studio and click the Distribution Units node.


    • Select Cabinet(CAB).




  4. Add items to your new CAB file.
    • From the Project menu, click Add Item.


    • Include the DLL you created earlier.




  5. Rebuild the Cabinet File Project.


  6. Create a HTML file as follows that references your control and the CAB file:
    
       <HTML>
       <HEAD>	
       <TITLE>
    	Deploy WFC Activex Control
       </TITLE>
       </HEAD>
       <BODY>
       <OBJECT id="JavaCtl"
        classid="CLSID:5D178FF9-AF1B-11D2-BAEE-0000F87A47A8"
        codeBase="JavaCtl.CAB#version=1,0,0,1">
       </OBJECT>
       </BODY>
       </HTML> 


  7. Launch the HTML file.


The ActiveX Control loads as expected. NOTE: To deploy this ActiveX Control to another machine or Web server, copy the .html file and the .CAB file.


REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, please see the following pages on the Microsoft Technical Support site:

http://support.microsoft.com/support/visualj/

http://support.microsoft.com/support/java/

Additional query words:

Keywords : kbCtrlCreate kbJava kbVJ600 kbWFC kbGrpJava kbDSupport
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: November 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.