前提安装好了VisualVM,并且安装了插件BTrace(期间出现了一个小问题,那就是标签里面怎么找不到BTrace标签,后面经过实践在VisualVM的application里找到要调试的进程,然后通过右击那个进程即可找到BeTrace这个标签,来进行coding)

      1、我这在esclipse里面的演示demo coding如下:

 1 /**
 2  * 
 3  */
 4 /**
 5  * @author Administrator
 6  *
 7  */
 8 package com.lyq.demo;
 9 
10 import java.io.BufferedReader;
11 import java.io.IOException;
12 import java.io.InputStreamReader;
13 
14 public class BTraceTest{
15     
16     public int  add(int a, int b) {
17         return a+b;
18     }
19     
20     public static void main(String[] argStrings) throws IOException{
21         
22         BTraceTest bTraceTest = new BTraceTest();
23         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
24         
25         for(int i=0; i<10; ++i){
26             reader.readLine();
27             int a = (int)Math.round(Math.random()*1000);
28             int b = (int)Math.round(Math.random()*1000);
29             System.out.println(bTraceTest.add(a, b));
30         }
31         
32     }
33 }
View Code

相关文章: