title: Cannot get -javaagent to run without error
body: <p>I'm trying to create a simple Java Agent program before I implement the real thing.  I cannot get it to run.  Clearly I have some sort of configuration or class path problem.   No amount of looking and trying has lead to me the problem.</p>
  
  <p>If I run:<br/></p>
  
  <blockquote>
    <p>java -cp ./demoAgent.jar -javaagent:./demoAgent.jar com.kingtigerbooks.demoMod.Main</p>
  </blockquote>
  
  <p>I get the following error:</p>
  
  <pre><code>Exception in thread "main" java.lang.ClassNotFoundException: com.kingtigerbooks.demoAgent.Agent
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
      at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
  FATAL ERROR in native method: processing of -javaagent failed
  Abort trap
  </code></pre>
  
  <p>I'm running this on my Mac.  The jar file with the agent is in the current directory.  The manifest for the jar file looks like this:</p>
  
  <pre><code>Manifest-Version: 1.0
  Premain-class: com.kingtigerbooks.demoAgent.Agent
  Can-Redefine-Classes: true
  </code></pre>
  
  <p>If smells like a class path problem, but as you can see I have included the jar on the class path.  Any help would be appreciated.  Its a very simple project.</p>