This documentation is archived and is not being maintained.

How to: Upgrade Visual J++ 6.0 Applications That Use Resources

Visual Studio 2005


The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Before an existing Visual J++ resource can be embedded or linked to managed assemblies for use on the common language runtime, the resource files must be converted to a format supported by the .NET Framework.

Although the file extension for resources under both the .NET Framework and Visual J++ 6.0 is .resources, the two files formats are, in fact, very different and are not interchangeable.

Converting Resources

When upgrading a Visual J++ project, the Visual J# Upgrade Wizard automatically converts the Visual J++ resource (.resources and .properties) files associated with the upgraded project into .NET Framework resource (.resx) files. When the project is later built in Visual J#, the .resx files are converted into .NET Framework resource (.resources) files and embedded into the output of the project.

Resources in file formats other than .resources or .properties (like .bmp or .gif) are not automatically handled by the Upgrade Wizard. These resources need to be manually converted to .resx file format and added to the upgraded project.

The following steps show how to manually convert Visual J++ 6.0 project resources into .NET Framework resources.

To manually convert resources

  1. Identify all resource files used in the Visual J++ project.

  2. Convert these resource files to .NET Framework resource (.resx) files using the Vjsresgen.exe tool provided with the Visual J# samples.

  3. Add the .resx files generated to the upgraded project.

  4. To compile a project from the command prompt, convert the resource in .resx file format to the .resources file format using the .NET Framework tool Resource File Generator (Resgen.exe). This prepares the resources for embedding or linking into a managed assembly.

  5. Specify the Visual J# compiler /resource option to embed the resource into the managed assembly. If the application is only available in .class format, use the Visual J# Binary Converter Tool and specify the /linkresource option.

Resource Compatibility Issues with Visual J++ 6.0

In Visual J++ 6.0 every resource is associated with a class. Resources associated with a class should be embedded or linked into the same assembly that the class is contained in.

  • In Visual J#, if the original Visual J++ resource file is modified, the .NET Framework resource file needs to be re-created and added to the assembly again.

  • Dynamically generating and consuming resources is not supported.

  • Resource files attached using the /win32res compiler option cannot be accessed using the Class.getResource or Class.getResourceAsStream method.

  • Resources associated with a class should be embedded or linked into the same assembly that the class is contained in. If a single resource is shared among multiple classes, the resource must be embedded or linked into each of the assemblies the classes are built into.

For more information on Visual J# compiler options used to embed or link resources into managed assemblies, see Visual J# Compiler Options. For more information on the Visual J# Binary Converter Tool (JbImp.exe) options, see Visual J# Binary Converter Tool.

For more information on Resgen.exe, see Resource File Generator (Resgen.exe).

See Also