IBM Support

Reverse engineering .class files into a Java Code Model in Rational XDE for the Java Platform

Troubleshooting


Problem

This technote describes how to reverse engineer .class files into a Java code model in Rational® XDE™ for the Java platform

Resolving The Problem

To be able to reverse engineer .class (or .java) files into a model the files have to be available within a project. It is not possible to reverse engineer files from the file system outside a project. If you want to reverse engineer *.class files into a Java model, below are the steps you will need to go through:

  1. Open the File menu -> Import... An Import window appears.
  2. On the first screen of the Import window select File system as your import source. Click Next.
  3. On the next screen you must first specify the location of your .class file(s) by listing the directory in which the .class files are located in the Directory box. When the directory has been specified you will then be able to select the file types within the directory that you wish to import into your Java project.

    In this case you will choose only files with the .class extension. Click the Filter Types… button and select the file type(s) to import, in this case *.class. This will cause all files with .class extensions that are present in the selected directory to become visible in the list box found on the right hand side. You can then opt to add any or all files with that file extension to your Java project.
  4. In the destination folder specify the Java project to which you wish to add these .class files. Then click Finish. If you navigate over to the project you will notice that the *.class files have been physically imported into the project.

    In the Navigator tab (of the Modeling Perspective) you can now see that the .class files have been added to the desired Java project. We now need to reverse engineer these files into our Java Code Model.
  5. In the Model Explorer tab right click on the top level Java Code Model package and select 'Reverse Engineer' from the context menu. Note that Synchronize will not work for *.class files. You have to select Reverse Engineer.
  6. In the resultant Add/Remove Modeled files dialog box set the File Types to '*.class' and click on the 'Add Recursively' button. Let the starting folder be the root Java project folder. Click OK.
  7. The .class file(s) will now get reverse engineered into your Java Code Model and will be visible in the Model Explorer. Note that although the .class file(s) have been reverse engineered into a Java Code Model, code cannot be generated from the model (in essence update the .class files) since these are compiled files. If your intent is to generate code from your classes in the model you must be working with .java files.



[{"Product":{"code":"SSSJ2Z","label":"Rational XDE Java"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2002 Release 2;2002.05.20;2002 Release 2.1;2002.05.21;2003;2003.06.00;2003.06.01;2003.06.12;2003.06.13","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSSHYJ","label":"Rational XDE Developer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"2002.05.20;2002.05.21;2003.06.00;2003.06.01;2003.06.12;2003.06.13","Edition":"","Line of Business":{"code":"","label":""}}]

Historical Number

111853801

Document Information

Modified date:
16 June 2018

UID

swg21136394