title: Java Could not find agent library hprof on the library path
body: <p>I was trying to profile CPU usage in my code and discovered the built-in hprof. <a href="https://docs.oracle.com/javase/8/docs/technotes/samples/hprof.html" rel="nofollow noreferrer">https://docs.oracle.com/javase/8/docs/technotes/samples/hprof.html</a></p>
  <p>However, as I tested I got the following error:</p>
  <p><code> javac -J-agentlib:hprof=cpu=samples Main.java</code>
  Error occurred during initialization of VM
  Could not find agent library hprof on the library path, with error: Can't find dependent libraries</p>
  <p>I believe I am having a path issue, however, I have no clue of where this library is located to try adding to the path, I am using the <code>jdk-15.0.2.</code></p>
  <ul>
  <li>I have already tried to look for &quot;hprof&quot; in my jdk folder, however can´t find anything.</li>
  <li>So I tried to check in the documentation, however, I could only find a path for a demo for the javase8 <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr008.html#BABIDBJJ" rel="nofollow noreferrer">https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr008.html#BABIDBJJ</a>. However, it points to a demo code JAVA_HOME/demo/jvmti/hprof that does not exist in my jdk.</li>
  </ul>
  <p>Does anyone have an idea of what could I try to find the exact location?
  Or any other alternative/Visual Studio Code extension to profile a java code?</p>
  <p>Thanks a lot</p>