HOW TO: Upgrade Visual J++ Components to Visual J# .NET
This article has been archived. It is offered "as is" and will no longer be updated.
You can compile and run Visual J++ 6.0 Java-language or Microsoft COM components that are used from COM clients.
The steps in the "More Information" section describe how to manually upgrade Java-language or COM components by using a command-line tool. When you upgrade Visual J++ projects in Microsoft Visual Studio .NET, the Microsoft Visual J# Upgrade wizard automates the upgrade process for Visual J++ components.
Important If the Java-language or COM component was implemented by using the templates that are generated by the JActiveX tool, or your Java-language component implements a type library interface, you must do steps a and b before you do the numbered steps in these instructions:
- Use the Tlbimp.exe command-line tool that is included with the Microsoft .NET Framework SDK and Visual Studio .NET to generate managed wrappers from the type library that you used to generate the JActiveX templates. For example, type the following at a command prompt, and then press ENTER: tlbimp.exe /keyfile:interopKey.snk COMComponent.tlb
- In step 1 of the numbered steps, reference the managed wrapper assemblies that you generated in step a when you compile the Java-language or COM component. For example, type the following at a command prompt, and then press ENTER:vjc /r:TlbimpGeneratedWrappers JavaSources
- Compile the Java-language or COM component by using the Visual J# .NET command-line compiler (Vjc.exe). For example, type the following at a command prompt, and then press ENTER to compile the code: vjc /target:library JavaSources
- Sign the assembly before you register it by using the /codebase option of the Regasm tool. To sign an assembly, attach the AssemblyKeyFile attribute that is located in the System.Reflection namespace to one of the files in your project, as in the following example: where myKey.snk is a key pair file that the .NET Framework SDK tool Sn.exe generates.
/** @assembly System.Reflection.AssemblyKeyFile("myKey.snk") */
- If a COM client gains access to the Java-language or COM component by using the type library that the VJReg.exe tool generates, the COM client uses the dispinterface that is exposed on the component and . The dispIds of the class members are not guaranteed to be the same in Visual J#. If the dispIds of the class members are different from what they were in the Visual J++ version, the existing COM clients may fail. To avoid this problem, verify the following if a type library exists for the Java-language or COM component:
- The type library is registered on the computer.
- The GUID of the type library is specified by using the typelib parameter in the @com.register directive for the component.
- Register the generated DLL file or EXE file by using the Regasm.exe command-line tool. (This tool is included with the Microsoft .NET Framework SDK and Visual Studio .NET.) To do this, type the following at a command prompt, and then press ENTER: Regasm /codebase generated_DLL_or_EXE
For more information about how to upgrade Visual J++ components, visit the following Microsoft Web site:
Article ID: 818429 - Last Review: 01/17/2015 07:06:46 - Revision: 1.4
Microsoft Visual J# .NET 2003 Standard Edition, Microsoft Visual J++ 6.0 Standard Edition
- kbnosurvey kbarchive kbhowto kbupgrade kbjava kbdll kbcompiler KB818429