Microsoft KB Archive/246557

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Article ID: 246557

Article Last Modified on 6/14/2006



APPLIES TO

  • Microsoft Software Development Kit for Java 1.51
  • Microsoft Software Development Kit for Java 2.02
  • Microsoft Software Development Kit for Java 3.0
  • Microsoft Software Development Kit for Java 3.0
  • Microsoft Software Development Kit for Java 3.1
  • Microsoft Software Development Kit for Java 3.2
  • Microsoft Software Development Kit for Java 4.0
  • Microsoft Visual J++ 6.0 Standard Edition
  • Microsoft Java Virtual Machine



This article was previously published under Q246557

SUMMARY

InstlWrap.exe illustrates how to install wrapper classes that your Java Object uses onto a client computer. These wrapper classes are 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 - 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 - 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 find these files:

  • TestWrap.bat - the batch file that contains the commands to cab and sign.
  • TestWrap.htm - the html file that loads the applet.


MORE INFORMATION

The following file is available for download from the Microsoft Download Center:

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services


Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. 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 Visual J++ 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; this displays the "Hello World!" message. The test certificate does not appear for any subsequent loading of this applet.


Note The applet loads as expected but it does not 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 (which was generated in step 3 above 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; this loads the applet. The test certificate does not appear for any subsequent loading of this applet.

    Note Note that on a client computer or a computer with no development tools on it, the applet loads as expected, but clicking on the Applet's Click Here button does not display the string from the DLL because the client computer does not 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. Get the Native DLL on your client computer by writing a .inf file to instruct where you want the native DLL to be placed. Additionally, you need to modify the .osd file that points to this .inf file. Then you create an installcab using cabarc that includes this .inf + .osd + nativedll.dll and sign it with LowX permission.
  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 at the following Microsoft Web site:

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:

193877 How To Make Your Java Code Trusted in Internet Explorer



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




Additional query words: InstlWrap

Keywords: kbhowto kbdownload kbjava kbfile kbjnative kbsecurity kbsample KB246557