try { InetAddress addr = InetAddress.getLocalHost(); System.out.println("Local HostAddress: "+addr.getHostAddress()); Runtime.getRuntime().exec("cmd /c start http://"+addr.getHostAddress()+":8080/files");//可以指定自己的路径 } catc
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地址及主机名 | 菜鸟教程