memoryshot failing

Questions about YourKit Java Profiler
Post Reply
zeqingchen
Posts: 4
Joined: Sat Dec 23, 2017 10:11 pm

memoryshot failing

Post by zeqingchen »

I tried to profile my java code programmatically and automatically. So, I use Controller and MemorySnapshot these 2 classes' api. But I always got null Controller and got exceptions to create Controller. I feel like it is about license. I have license and could profile my applicaiton using the Yourkit application. However, I do not know how to use code to tell Yourkit that I have license. Could you help me? so I can write a program using Yourkit to save snapshot automatically
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: memoryshot failing

Post by Anton Katilin »

Please provide the exception stack trace.

Please ensure you properly add profiler JARs to the classpath, as the help suggests:
https://www.yourkit.com/docs/java/help/api.jsp
zeqingchen
Posts: 4
Joined: Sat Dec 23, 2017 10:11 pm

Re: memoryshot failing

Post by zeqingchen »

cause={Exception@5126}"java.lang.Exception:To profile application, you should run it with the profiler agent"
stackTrace = {StackTraceElement[0]@5129}

I try to create a controller = new Controller();
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: memoryshot failing

Post by Anton Katilin »

Yes, profiled applications should run with the agent:
https://www.yourkit.com/docs/java/help/agent.jsp
zeqingchen
Posts: 4
Joined: Sat Dec 23, 2017 10:11 pm

Re: memoryshot failing

Post by zeqingchen »

Sorry, I am newbie. I don't know if I get you. So, what do you mean by profiler agent? So, I assume that you want me to open Yourkit while I run Yourkir progrmatically? Also, I try to do -agentpath... in my application directory. However, it fails saying no BASH command are matched.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: memoryshot failing

Post by Anton Katilin »

Please read the mentioned docs. It describe what the agent purpose is and how to configure it in Java command line.
Post Reply