One of the obstacles to developing J2EE applications is the code-deploy-test cycle. Typically a change the code requires you to restart OC4J to pick up the new classes. One way to speed this up is to use the Java Platform Debugging Architecture (JPDA). This allows JDeveloper to connect to OC4J, which has a couple benefits. First you can step through code and view variable values while your custom step runs. Second and most important, you can change code in JDeveloper and through the magic of hot-swap code deploy, JDeveloper will ship the code to the JVM and start using it right away. This is a huge speedup over building a jar, transferring it to the custom lib directory, and restarting the server.
To make this work, first you need to configure OC4J to listen for a JPDA debugger:
- Open Enterprise Manager (http://{hostname}:{port}/em) and click on the oc4j_soa instance.
- Click the Administration tab.
- Click on Server Properties.
- Under command-line options add the following line: -Xrunjdwp:transport=dt_socket,server=y,address=9901,suspend=n.
- Click Apply and then be sure to restart the OC4J server.
Next you need to configure your JDeveloper project for remote debugging:
- Right-click on the project and choose Project Properties.
- Click the Run/Debug option.
- Click on the default run configuration and click Edit…
- Under the Launch Settings option make sure the Remote Debugging and Profiling checkbox is checked.
- Choose the Debug > Remote option.
-
Enter the options as shown below:

- Click OK.
Now to connect to the OC4J instance simply right-click on the project and choose Start Remote Debugger:

JDeveloper is now connected to OC4J and if you put a breakpoint in the code and exercise the service, the execution will stop so you can step through the code. Furthermore, if you make a change and hit "Alt-Shift-F9" (Compile), the code will be shipped to the JVM and you can retest.


