常常运行Java时,好比运行Spring Cloud Boot项目都不知道去哪里关闭,端口被占用,若是修改程序之后再次启动就会报错java
先执行命令 web
ps -ef|grep java spring
查看有哪些Java程序在运行,若是tomcat启动了也能查看到其进程ID,好比:tomcat
501 33777 30392 0 1:08下午 ?? 0:13.06 /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:63422 -Dfile.encoding=UTF-8 -classpath /Users/liufang/Workspaces/MyEclipse Spring 2014/cloud-simple-helloword/target/classes:/Users/liufang/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.3.5.RELEASE/spring-boot-starter-web-1.3.5.RELEASE.jar......socket
执行命令:kill -9 33777就能够关闭掉这个项目,而后能够再次运行了spring-boot