java.rst
changeset 1215 84101bddf00c
parent 1214 fe28cec0bb40
child 1216 7a3ade740d3f
equal deleted inserted replaced
1214:fe28cec0bb40 1215:84101bddf00c
   145 
   145 
   146   $ jar cf myFile.jar *.class
   146   $ jar cf myFile.jar *.class
   147   $ jar cmf myManifestFile myFile.jar *.class
   147   $ jar cmf myManifestFile myFile.jar *.class
   148   $ jar -cfe Main.jar foo.Main foo/Main.class
   148   $ jar -cfe Main.jar foo.Main foo/Main.class
   149 
   149 
   150 Profiling java.
   150 Profiling Java.
   151 ===============
   151 ===============
   152 ::
   152 ::
   153 
   153 
   154   $ java -Xprof com.vendor.product.Clazz
   154   $ java -Xprof com.vendor.product.Clazz
   155   $ java -Xrunhprof:help
   155   $ java -Xrunhprof:help
   156 
   156 
       
   157 Debugging Java.
       
   158 ===============
       
   159 
       
   160 Compile with ``-g`` to preserve source code information::
       
   161 
       
   162   $ javac -g -cp $CLASSPATH -sourcepath $SRC_DIR -d $BUILD_DIR
       
   163 
       
   164 To run Java program in debugger::
       
   165 
       
   166   $ jdb -cp $CLASSPATH -sourcepath $SRC_DIR
       
   167 
       
   168 To attach to Java application you firstly must run application with::
       
   169 
       
   170   $ java -Xdebug -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=$PORT \
       
   171     com.vendor.product.Clazz
       
   172 
       
   173 and then attach with debugger::
       
   174 
       
   175   $ jdb -attach $PORT
       
   176