Prev Next

Attach to Virtual Machine

You can debug a Java application by attaching to a process that is hosting a Java Virtual Machine; you might want to do this for attaching to a webserver such as Tomcat or JBOSS.

The Java Virtual Machine Tools Interface from Sun Microsystems is the API used by Enterprise Architect; it allows a debugging agent to be specified when the JVM is created.

To debug a running JVM from Enterprise Architect, the Sparx Systems' debugging agent must have been specified as a startup option to the JVM when it was started; how this is accomplished for products such as Tomcat and JBOSS should be researched from that product's own documentation.

For java.exe, the command line option to load the Enterprise Architect debugging agent could be (depending on your environment):

  • -agentpath:"c:\program files\sparx systems\ea\VEA\x86\SSJavaProfiler32"
  • -agentpath:"c:\program files (x86)\sparx systems\ea\VEA\x86\SSJavaProfiler32"
  • -agentpath:"c:\program files (x86)\sparx systems\ea\VEA\x64\SSJavaProfiler64"

The appropriate option will depend on your operating system and whether you are working on a 32-bit application or a 64-bit application.

Alternatively, if you add the appropriate VEA directory to your PATH environment variable you can choose to use:

  • -agentlib:SSJavaProfiler32
  • -agentlib:SSJavaProfiler64

It is not necessary to configure an Analyzer Script when you attach to a Virtual Machine; you can just use the Attach button on one of the Analyzer toolbars.

If you configure an Analyzer Script, there are only two things that must be selected:

  • Select 'Java' as the debugging platform
  • Choose the 'Attach to Virtual Machine' option

Learn more