Forms Developer How-To Document
February 11, 2003
Pluggable Java Components (PJCs) provide a powerful mechanism for extending the Forms Java Client with custom functionality. However, PJCs have to be written in Java and the process of debugging such components when embedded in the Forms runtime using print statements alone, is time consuming. This How-To takes you through the steps required to set up your Oracle9 i Forms Developer installation and Oracle9 i JDeveloper 9.0.2 to debug your PJC code live inside of a running Forms application. These instructions also equally apply to Oracle9 i JDeveloper 9.0.3 (although the screen layouts may be slightly different).
This How-To does not cover the basic steps of building a PJC. For more information on creating PJCs see:
These instructions assume that you have already set up and are successfully running both Oracle9 i Forms Developer and Oracle9 i JDeveloper, that you have an existing PJC project in JDeveloper that you wish to debug, and an existing test Form which uses that PJC. The locations of any Forms, Menus or Libraries that you are using as part of the test should be defined in your FORMS90_PATH environment variable.
Furthermore the instructions assume that you are developing using a standard Oracle9 i Forms Developer OC4J installation listening on port 8888 on your development machine. If this is not the case, you will have to make some slight changes to the instructions below to conform to your actual configuration.
If you are creating a PJC you will already have the f90all.jar file associated as a library in your project. However, if you have patched your Oracle9iDS install you may have several versions of the f90all.jar file available. When debugging through JDeveloper you need to ensure that the library being used in JDeveloper is the same version as that being used by your Form install. The simplest way to do this is to ensure that the f90all.jar that is being used is the one from your %ids_home%/forms90/java directory.
To confirm this, select your project and choose Project Settings and select the Libraries node in the navigator. You should see a library entry for Oracle Forms in the Selected Libraries list. Select this and click the Edit button to confirm that you are indeed using the version of f90all.jar from your forms90/Java directory. For example:
Fig 1- Editing the location of the f90all.jar file
If you do not use the correct version of f90all.jar you may get a runtime error "Client too Old" if that happens, edit the library location as described above.
The key part of setting up PJC debugging is the creation of an HTML file to launch your test Form in a way that can be used for debugging. The following file provides a basic template.
Fig 2- Template Debugging HTML file
Note that the Archive attribute of the <APPLET/> tag only contains the f90all.jar. It does not contain a jar file with your PJC code in it. This code will be picked up from your JDeveloper project.
In this basic html template, the only value you will have to change to match your project is the value of the serverArgs parameter which will need to be updated to name a suitable test form to launch, and any other Forms parameters such as the logon information that are required.
This html file should be called something suitable such as "debug_pjc.html" and should be saved into the %ids_home%/forms90/Java directory.
To debug your PJC you will be running the html file that you have just created. Select your project and click the Add to Project button select the debug_pjc.html file that you have just created from the %ids_home%/forms90/Java directory.
You are just about ready to run and debug your Form and PJC from within JDeveloper. All you have to do now is to set up suitable breakpoints in your PJC code. With most PJCs all of the calls come through the setProperty() and getProperty() methods so those are a good place to start.
To debug your PJC, ensure that your OC4J engine is started, right mouse click on the debug_pjc,html file to get the context menu, and choose "Debug debug_pjc.html".
JDeveloper will start an AppletViewer process (the size of this AppletViewer window is controlled by the HEIGHT and WIDTH attributes in your html file) and your Form will run within the AppletViewer frame. When your PJC breakpoint is encountered as you run the Form, control will return to JDeveloper where you can inspect variables and step through and debug your custom code.