title: Not able to pass -javaagent as JVM arg to Jetty 9
body: <p>I wanted to use jamm in our project. For that to be used, I have to pass '-javaagent:&lt;..path...>/jamm-0.2.5.jar' as JVM args. </p>
  
  <p>I am able to pass this argument in tomcat by adding the jar to tomcat/lib folder and modified startup.bat as follows:</p>
  
  <pre><code>set JAVA_OPTS=-Xms1024m -Xmx1024m -XX:MaxPermSize=256m -javaagent:"%CATALINA_HOME%\lib\jamm-0.2.5.jar"
  call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
  </code></pre>
  
  <p>But I am not able to achieve the same in Jetty9. As done in Tomcat, I have copied the jamm-0.2.5.jar to jetty-distribution-9.2.3.v20140905/lib and added the following in startup.ini</p>
  
  <pre><code>--exec
  -Xms1024m 
  -Xmx1024m 
  -XX:MaxPermSize=256m 
  -Xdebug 
  -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n
  -javaagent:E:\jetty-distribution-9.2.3.v20140905\lib\jamm-0.2.5.jar
  </code></pre>
  
  <p>It is not working. Also I tried removing this and adding it in jetty.sh </p>
  
  <pre><code>#####################################################
  # Add jetty properties to Java VM options.
  #####################################################
  JAVA_OPTIONS+=("-Djetty.home=$JETTY_HOME" "-Djetty.base=$JETTY_BASE" "-Djava.io.tmpdir=$TMPDIR" "-javaagent:$JETTY_HOME/lib/jamm-0.2.5.jar")
  </code></pre>
  
  <p>But it did not work. Where should I pass these jvm args in jetty? Can't I refer to JETTY_HOME the same way as I have done with TOMCAT_HOME in tomcat?</p>
  
  <p>Note: I am working on Windows 8. Here is the output of java -jar start.jar --list-config:</p>
  
  <pre><code>Java Environment:
  -----------------
   java.home = C:\Program Files\Java\jre7
   java.vm.vendor = Oracle Corporation 
   java.vm.version = 23.0-b21 
   java.vm.name = Java HotSpot(TM) 64-Bit Server VM
   java.vm.info = mixed mode
   java.runtime.name = Java(TM) SE Runtime Environment
   java.runtime.version = 1.7.0_04-b22 
   java.io.tmpdir = C:\Users\PGULLA~1\AppData\Local\Temp\ 
   user.dir = E:\jetty-distribution-9.2.3.v20140905
   user.language = en
   user.country = US 
  
  Jetty Environment: 
  -----------------
   jetty.version = 9.2.3.v20140905 
   jetty.home = E:\jetty-distribution-9.2.3.v20140905
   jetty.base = E:\jetty-distribution-9.2.3.v20140905
  
  Config Search Order: 
  -------------------- 
   &lt;command-line&gt; 
   ${jetty.base} -&gt; E:\jetty-distribution-9.2.3.v20140905 
   ${jetty.home} -&gt; E:\jetty-distribution-9.2.3.v20140905 
  
  
  JVM Arguments:
  --------------
   -Xms1024m
   -Xmx1024m
   -XX:MaxPermSize=256m
   -Xdebug
   -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n
   -javaagent:E:\jetty-distribution-9.2.3.v20140905\lib\jamm-0.2.5.jar
  
   System Properties:
  ------------------
   (no system properties specified) 
  
  Properties:
  -----------
   http.timeout = 30000
   jetty.dump.start = false 
   jetty.dump.stop = false
   jetty.output.buffer.size = 32768 
   jetty.port = 8081
   jetty.request.header.size = 8192 
   jetty.response.header.size = 8192
   jetty.send.date.header = false
   jetty.send.server.version = true 
   jsp-impl = apache
   threads.max = 200
   threads.min = 10 
   threads.timeout = 60000
  
   Jetty Server Classpath:
  -----------------------
  Version Information on 35 entries in the classpath.
  Note: order presented here is how they would appear on the classpath.
   changes to the --module=name command line options will be reflected here.
   0:0.2.5 | ${jetty.base}\lib\ext\jamm-0.2.5.jar
   1:9.2.3.v20140905 | ${jetty.base}\lib\apache-jsp\org.eclipse.jetty.apache-jsp-9.2.3.v20140905.jar
   2: 3.8.2.v20130121-145325 | ${jetty.base}\lib\apache-jsp\org.eclipse.jetty.orbit.org.eclipse.jdt.core-3.8.2.v20130121.jar
   3:8.0.9 | ${jetty.base}\lib\apache-jsp\org.mortbay.jasper.apache-el-8.0.9.M3.jar
   4: 2.3 | ${jetty.base}\lib\apache-jsp\org.mortbay.jasper.apache-jsp-8.0.9.M3.jar 
   5:1.2.1 | ${jetty.base}\lib\apache-jstl\org.apache.taglibs.taglibs-standard-impl-1.2.1.jar 
   6:1.2.1 | ${jetty.base}\lib\apache-jstl\org.apache.taglibs.taglibs-standard-spec-1.2.1.jar 
   7:(dir) | ${jetty.base}\resources 
   8:3.1.0 | ${jetty.base}\lib\servlet-api-3.1.jar
   9: 3.1.0.M0 | ${jetty.base}\lib\jetty-schemas-3.1.jar 
  10:9.2.3.v20140905 | ${jetty.base}\lib\jetty-http-9.2.3.v20140905.jar 
  11:9.2.3.v20140905 | ${jetty.base}\lib\jetty-server-9.2.3.v20140905.jar
  12:9.2.3.v20140905 | ${jetty.base}\lib\jetty-xml-9.2.3.v20140905.jar
  13:9.2.3.v20140905 | ${jetty.base}\lib\jetty-util-9.2.3.v20140905.jar 
  14:9.2.3.v20140905 | ${jetty.base}\lib\jetty-io-9.2.3.v20140905.jar 
  15:9.2.3.v20140905 | ${jetty.base}\lib\jetty-jndi-9.2.3.v20140905.jar 
  16: 1.4.1.v201005082020 | ${jetty.base}\lib\jndi\javax.mail.glassfish-1.4.1.v201005082020.jar 
  17: 1.2 | ${jetty.base}\lib\jndi\javax.transaction-api-1.2.jar
  18:9.2.3.v20140905 | ${jetty.base}\lib\jetty-security-9.2.3.v20140905.jar
  19:9.2.3.v20140905 | ${jetty.base}\lib\jetty-servlet-9.2.3.v20140905.jar 
  20:9.2.3.v20140905 | ${jetty.base}\lib\jetty-webapp-9.2.3.v20140905.jar
  21:9.2.3.v20140905 | ${jetty.base}\lib\jetty-deploy-9.2.3.v20140905.jar
  22:9.2.3.v20140905 | ${jetty.base}\lib\jetty-plus-9.2.3.v20140905.jar 
  23:9.2.3.v20140905 | ${jetty.base}\lib\jetty-annotations-9.2.3.v20140905.jar
  24:5.0.1 | ${jetty.base}\lib\annotations\asm-5.0.1.jar
  25:5.0.1 | ${jetty.base}\lib\annotations\asm-commons-5.0.1.jar 
  26: 1.2 | ${jetty.base}\lib\annotations\javax.annotation-api-1.2.jar
  27: 1.0 | ${jetty.base}\lib\websocket\javax.websocket-api-1.0.jar
  28:9.2.3.v20140905 | ${jetty.base}\lib\websocket\javax-websocket-client-impl-9.2.3.v20140905.jar
  29:9.2.3.v20140905 | ${jetty.base}\lib\websocket\javax-websocket-server-impl-9.2.3.v20140905.jar
  30:9.2.3.v20140905 | ${jetty.base}\lib\websocket\websocket-api-9.2.3.v20140905.jar
  31:9.2.3.v20140905 | ${jetty.base}\lib\websocket\websocket-client-9.2.3.v20140905.jar 
  32:9.2.3.v20140905 | ${jetty.base}\lib\websocket\websocket-common-9.2.3.v20140905.jar 
  33:9.2.3.v20140905 | ${jetty.base}\lib\websocket\websocket-server-9.2.3.v20140905.jar 
  34:9.2.3.v20140905 | ${jetty.base}\lib\websocket\websocket-servlet-9.2.3.v20140905.jar
  
  Jetty Active XMLs:
  ------------------
   ${jetty.base}\etc\jetty.xml
   ${jetty.base}\etc\jetty-http.xml
   ${jetty.base}\etc\jetty-deploy.xml
   ${jetty.base}\etc\jetty-plus.xml
   ${jetty.base}\etc\jetty-annotations.xml
  </code></pre>