Home Up Feedback Contents Search

Debugging Java ACPs
 

Back to Smallworld Technical

Since many ACPs require specific communications between Magik and the running ACP process, you must debug the process after it has been started with Magik. To do  this, you need to start the Java Virtual Machine (JVM), which is started with java (or java.exe), with certain flags to make the process available to the debugger. The following steps need to be done in order to correctly start the JVM. This process can be used to start and debug the java process on a remote host as well.

  • Compile your java file using the -g (debug) option.
  • You must run java (or java.exe) from the Java Developers Kit (JDK) directory, not the Java Runtime Environment (JRE) directory. To do this, you need to set the SW_ACP_PATH appropriately.
  • You need to add the following options to the ACP's command slot:
    -Xdebug -Xnoagent -Djava.compiler=NONE
    -Xrunjdwp:transport=dt_socket,server=y,address=3999,suspend=n

    The above address is the port to which you will attach, the transport is how you will attach, there is a shared memory option for WIndows platforms only, but I have not used it.
     

  • Start the ACP.
  • Start your Java Debugger.
  • Select Attach through your debugger (for "Forte for Java", it is located at Debu->Attach...)
  • Select Connection type to be "Socket Attach"
  • Enter the Host that the java process is running.
  • For the Port number, enter the address that you assigned in the ACP command slot.
  • Set your break points in your debugger.
  • Continue the java process in magik.

Also if you are using Java 1.5 or above you will need to ask GE for a patch to fix the extra information that the new releases seem to put on the stream. The error will be in the verify_connection() method and will say something about a bad stream. You can contact us at info@field-csi.com to get the patch also.

Send mail to webmaster@field-csi.com with questions or comments about this web site.
Copyright © 2007 Field Consulting and Services, Inc.
Last modified: 05/30/07