ad5081d3
孙向锦
初始化项目
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
public class PublicUtil {
public static void main(String[] args) {
System.out.println("本机的ip=" + PublicUtil.getIp());
}
public static String getPorjectPath(){
String nowpath = "";
nowpath=System.getProperty("user.dir")+"/";
return nowpath;
}
/**
* 获取本机访问地址
* @return
*/
public static String getIp(){
String ip = "";
try {
InetAddress inet = InetAddress.getLocalHost();
ip = inet.getHostAddress();
//System.out.println("本机的ip=" + ip);
} catch (UnknownHostException e) {
e.printStackTrace();
}
return ip;
}
}
|