0
点赞
收藏
分享

微信扫一扫

Springboot项目启动后自动在浏览器打开


Springboot项目启动后自动在浏览器打开_spring

 

try {
InetAddress addr = InetAddress.getLocalHost();
System.out.println("Local HostAddress: "+addr.getHostAddress());
Runtime.getRuntime().exec("cmd /c start http://"+addr.getHostAddress()+":8080/files");//可以指定自己的路径
} catch (Exception ex) {
ex.printStackTrace();
}

​​Java 实例 – 获取本机ip地址及主机名 | 菜鸟教程​​


举报

相关推荐

0 条评论