java获取当前进程号
public class PID { public static void main(String[] args){ String processName = java.lang.management.ManagementFactory.getRuntimeMXBean().getName(); String processID = processName.substring(0,processName.indexOf('@')); System.out.println("processID="+processID); } }