4 Testing and Debugging Extensions

This chapter describes how to use the tools and features provided by JDeveloper to run and debug Java programs.

This chapter includes the following sections:

4.1 About Testing and Debugging Extensions

You test and debug an extension by installing it and running it in a debug instance of JDeveloper.

4.2 Debugging Extension Code

JDeveloper provides you with a comprehensive debugger to test your code. For general information about debugging in JDeveloper, see "Debugging Applications" in Developing Applications with Oracle JDeveloper.

To debug an extension, you run it in JDeveloper. A new instance of JDeveloper opens in debug mode with the extension installed. If something is not working correctly then you can set breakpoints in your extension code to debug it.

4.2.1 How to Run a JDeveloper Extension

When you have developed the code for your extension, you will want to try it out. To do this you install the extension and then run JDeveloper. A new instance of JDeveloper runs in debug mode for you to test your extension.

To run an extension in JDeveloper:

  • From the context menu of the project in the Applications window, or in the source editor, choose Run Extension.

A new version of JDeveloper starts with the extension running in it.

4.2.2 How to Debug a JDeveloper Extension

With the extension running in a debug version of JDeveloper, you can test the functionality and use the JDeveloper debugging features to find and fix problems. For more information see "Debugging Applications" in Developing Applications with Oracle JDeveloper.

To debug an extension in JDeveloper:

  1. Enter suitable breakpoints in your code.

  2. From the context menu of the project in the Applications window, or in the source editor, choose Debug Extension.

A new version of JDeveloper starts in debug mode with the extension running in it.

4.3 Troubleshooting Debugging

Use this list of symptoms and solutions to resolve extension issues:

  • Symptom: Exception at startup.

    Solution: Check stack trace and debug it.

  • Symptom: Extension does not load.

    Solution: Check the Features dialog (available from the Tools menu) to make sure the extension is enabled when JDeveloper launches. For more information, see "How to Manage JDeveloper Features" in Developing Applications with Oracle JDeveloper.

  • Symptom: Class cast exception.

    Solution: For an extension that was written for an earlier version of JDeveloper, some code has not been migrated, or the extension was compiled against an older version of JDeveloper. Check to see that the extension has been migrated. For more information, see Section 1.4, "Migrating Extensions from Previous Releases."