I found a simple way to enable Remote Debugging in OC4J stand-alone version 10.1.3. I assume it will work on other versions.
I was looking at the startup script (oc4j.cmd on Windows) that is found in the bin directory of your OC4J install. I was looking for where exactly to add the necessary startup options in the script to enable remote debugging.
I found that the script reads from an environment variable OC4J_JVM_ARGS to look for additional startup parameters.
Rather than muck about with the canned startup script, I simply created an environment variable OC4J_JVM_ARGS which contains the following value:
This was picked up by OC4J and the container launched with remote debugging enabled on port 4000.
Now, I want to be able to easily turn remote debugging on and off, but I don’t want to have to remember the pesky parameters every time, so I took another step.
I created a second Environment Variable OC4J_DEBUG with the value set to
I then changed the OC4J_JVM_ARGS parameter to contain a value of %OC4J_DEBUG%
Now to turn debugging on and off, I simply modify the value of OC4J_JVM_ARGS and add or remove my %OC4J_DEBUG% variable. It’s less typing and easier to remember.