How to Install Wrapper Classes on the User's Computer

ID: Q246557


The information in this article applies to:
  • Microsoft SDK for Java, versions 1.51, 2.02, 3.0, 3.0 Preview 1, 3.1, 3.2, 4.0
  • Microsoft Visual J++, version 6.0
  • Microsoft virtual machine


SUMMARY

The following files are available for download from the Microsoft Software Library. Click the file names below to download the files:

InstlWrap.exe
InstlWrap.exe illustrates how to install wrapper classes that your Java Object uses onto a client computer. These wrapper classes are nothing but the ones that are generated using JACTIVEX or by using the Add COM Wrappers in Visual J++ 6.0.

This sample contains two projects:
  • atldll - is an ATL (Active Template Library) DLL project built using Visual C++ 6.0. This contains a single method that just displays a string. The project also contains a released version of atldll.dll;


  • TestWrap - is the Java project built using VJ++ 6.0. This includes TestWrap.java that calls the ATL DLL method created in Step 1, through its wrapper classes.
Within the TestWrap project, you will find these files:
  • TestWrap.bat - is the batch file that contains the commands to cab and sign.
  • TestWrap.htm - is the html file that loads the applet.


MORE INFORMATION

The following steps illustrate how to use this sample:

On the development machine:

  1. Run JACTIVEX.exe of the SDK or use the Add COM Wrappers menu in VJ++ 6.0 to create the wrapper classes for the ATL DLL object.


  2. Build the Applet along with the wrapper classes.


  3. Run TestWrap.bat from the TestWrap folder. This batch file assumes that you have set up the path to the
    SDKForJava40/Bin 
    folder correctly. Once the batch file succeeds it displays a Test Certificate asking whether you want to install and run the MyCab.cab file, which contains the signed applet along with the wrappers. Click Yes, which loads the applet. Now click on the Applet's button that says Click Here, which displays the "Hello World!" message. The test certificate will not appear for any subsequent loading of this applet. NOTE: The applet loads fine but it won't display the string from the DLL if atldll.dll is not registered on the development computer. You can register the DLL manually using Regsvr32.exe.


On the target computer:

  1. Copy MyCab.cab (that was generated in Step 3 earlier using TestWrap.bat), along with TestWrap.htm onto the client computer.


  2. Open TestWrap.htm in your browser. This displays the same Test Certificate asking whether you want to install and run the MyCab.cab file. Select "Yes," which loads the applet. The test certificate will not appear for any subsequent loading of this applet. NOTE: You will notice that, on a client computer or a computer with no development tools on it, the applet loads fine, but clicking on the Applet's Click Here button won't display the string from the DLL, because the client computer doesn't have the native DLL registered on it. There are two ways to get this DLL on the client computer:


    1. Copy the DLL on the client computer and register it manually using Regsvr32.exe, or


    2. To get the Native DLL on your client computer, write a .inf file to instruct where you want the native DLL to be placed as well as modify the .osd file that points to this .inf file. Then you create an installcab using cabarc that will include this .inf + .osd + nativedll.dll and sign it with LowX permission. For more details, please refer to the following Knowledge-Base Article that uses this technique:

      For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
      Q238501 SAMPLE: InstallDLL.EXE Installs Applet and Native DLL Onto a Client Machine


  3. Once the applet loads successfully, you can browse to %windir%/DownLoaded Program Files in Windows Explorer to see if the wrapper classes are in the JPM. (windir = winnt or windows)


  4. You can find this out by seeing the Friendly Name, Install Wrapper Classes, under the Program File column. This shows that the MyCab.cab was successfully installed into the JPM.



REFERENCES

For more information on DUBUILD or CABARC and Code-Signing, please refer to the SDK For Java documentation available under the section Packaging and Distributing Software

For additional information on how to make your java code trusted under Internet Explorer, click the article number below to view the article in the Microsoft Knowledge Base:

Q193877 HOWTO: Make Your Java Code Trusted in Internet Explorer

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 : kbfile kbJava kbJavaVM kbJNative kbSecurity kbVJ600 kbGrpJava kbDSupport kbSDKJava320 kbSDKJava400
Version : WINDOWS:1.51,2.02,3.0,3.0 Preview 1,3.1,3.2,4.0,6.0
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: January 7, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.