在安装JDK的时候,就已经有jconsole,在JDK的bin目录找到jconsole.exe执行文件运行就行了
运行之后没有自己写的代码???
那就将程序运行之后再使用jconsole
public class Dome {
public static void main(String[] args) {
Thread t1 = new Thread(() -> {
while(true){
System.out.println("thread t1");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
},"thread t1");
t1.start();
Thread t2 = new Thread(() -> {
while(true){
System.out.println("thread t2");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
},"thread t2");
t2.start();
}
}