Search code examples
javaspring-bootjprofiler

Jprofiler can't get the agent to work


I'm trying to setup JProfiler for a very simple case at the beginning to see how it actually works, though i don't wanna use the IDE integration, i wanna use the command line. I'm running my jar (spring boot compiled) locally for starters with this command appended

-agentpath:/Applications/JProfiler.app/Contents/Resources/app/bin/macos/libjprofilerti.jnilib=port=8849

and i'm just doing a direct network connection from JProfiler to localhost on the port 8849 as mentioned in the documentation, yet it does not seem to work, i'm not able to connect on it for some reason. Anyone anyidea? I'm using macOs.


Solution

  • If you add the -agentpath parameter after the -jar argument, it will be passed as an argument to the main class and not load the agent.

    If you pass it before the -jar argument, the agent will be loaded. There will be output on stderr that is prefixed with JProfiler> that shows you some status information form the agent.

    Should the JVM not be able to load the agent for any reason, for example because the path to the native library is wrong, it will print an error and exit.