Profiling JBoss 7 using YourKit on Windows

This is how we got YourKit Profiler 2015 to work with JBoss 7 on Windows 7.

This short guide uses HOME directory variables that you need to match to your own personal setup.
1. Create the directory JBOSS_HOME\modules\com\yourkit\profiler\main\.

2. Copy YOURKIT_HOME\lib\yjp.jar to this new directory.

3. Create a module.xml file in this new directory with the following
contents.

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.yourkit">
    <resources>
        <resource-root path="yjp.jar"/>
    </resources>
</module>

4 Edit JBOSS_HOME\bin\standalone.conf.bat. Add the following lines
right at the end of the file, but before the :JAVA_OPTS_SET line.

rem # YourKit
set YOURKIT_AGENT={YOURKIT_HOME}\bin\win64\yjpagent.dll
set "JAVA_OPTS=%JAVA_OPTS% -agentpath:%YOURKIT_AGENT%=delay=10000
-Djboss.modules.system.pkgs=com.yourkit"

5. Change {YOURKIT_HOME} to the actual directory of YourKit.
{YOURKIT_HOME} cannot have any spaces. If your YourKit installation has
spaces in it, use the old DOS short names as a workaround.

6. Run JBoss 7. In YourKit, connect to the jboss-modules application.