How to debug a JBuilder OpenTool in JBuilder X

Summary: This is a brief discussion about how to debug a JBuilder OpenTool. Debugging an OpenTool is not at all like debugging normal Java code, and a special technique is required, specifically starting one instance of JBuilder from an existing JBuilder environment. These notes apply to JBuilderX, and may not work for other versions.

Still working with the JBuilder OpenTool API ... one of the early problems I've run into with developing OpenTool's is the need to debug my OpenTool. I had a significant problem getting a tool to work, and could not figure out how to debug it. Then I realized that the problem is that the OpenTool is loaded during the JBuilder startup, and I simply was not going to be able to debug this like I "normally" would.

After a little digging I found some notes from Judd Solutions that were very close to what I needed. I couldn't get them to work exactly as they are written, but they were extremely close. The biggest problem was that some of the libraries they reference are not in my version of JBuilder. So, without any further ado, here are my adaptations of their approach:

  1. In your current project, create a library configuration named something like "JBuilder" or "Debug JBuilder OpenTools".
  2. Add *all* the jar files from the JBuilder's lib directory to this library.
  3. What you're going to do next is start a JBuilder instance from within your current JBuilder instance. To do this, go to Project | Project Properties, then select the Run module. Add a Runtime Configuration with the following attributes:
    1. Name: whatever you want to name it.
    2. Build target: Make.
    3. Type: Application.
    4. Main class: com.borland.jbuilder.JBuilder.
    5. VM parameters: (none)
    6. Application parameters: -verbose -nosplash
  4. Running the project or debugging the project will now start a new instance of JBuilder. As Mr. Judd mentions, breakpoints and other debugging techniques will now work as they usually do.

Probably the most unusual thing at this time is that you will have two JBuilder instances running. This could be a little confusing, but hasn't been a major problem yet. Another interesting thing is that when the second JBuilder instance starts its output is shown in the Messages Pane of the first JBuilder instance.