title: how to specify class path for java agent
body: <p>I am write a Java Agent to instrument a target Method of a target Class.</p>
  
  <p>I use the javassist library to do instrument. </p>
  
  <p>So the java agent (let named CnAgent.class) need its dependency : javassist library to run.</p>
  
  <p>The directory hierarchy is :</p>
  
  <pre><code>.
  ├── META-INF
  │   └── MANIFEST.MF
  ├── com
  │   └── yet
  │       └── another
  │           └── test
  │               └── agent
  │                   ├── CnAgent.class
  │                   └── CnTransformer.class
  └── lib
      └── javassist-3.18.2-GA.jar
  </code></pre>
  
  <p>and the MANIFEST.MF file content is :</p>
  
  <pre><code>Manifest-Version: 1.0
  Class-Path: lib/javassist-3.18.2-GA.jar .
  Agent-Class: com.yet.another.test.agent.CnAgent
  Created-By: 1.8.0_11 (Oracle Corporation)
  Can-Retransform-Classes: true
  </code></pre>
  
  <p>I create jar ball by following command:</p>
  
  <pre><code>jar cvfm CnAgent.jar META-INF/MENIFIEST.MF . lib
  </code></pre>
  
  <p>when I load the Agent with Attach API of JVM. 
  the error prints :</p>
  
  <pre><code>error when transform : javassist/ClassPool
  java.lang.NoClassDefFoundError: javassist/ClassPool
  </code></pre>
  
  <p>which means the javassist library cannot be found by agent code.</p>
  
  <p>So my question is :</p>
  
  <ol>
  <li><p>How to set Agent library's class path letting it find the dependencies?</p></li>
  <li><p>Why the Class-Path option in MANIFEST.MF not works , does it only for jar directly ran in command line ?</p></li>
  </ol>
  
  <p>Thanks your wisdom :)</p>