package com.landtool.lanbase.modules.api.utils; import java.net.Inet4Address; import java.net.InetAddress; public class GetWebProUrl { public static String getLocalHostIP(){ String result = null; try { InetAddress IP = Inet4Address.getLocalHost(); String ip = IP.toString(); int index = ip.indexOf('/'); result = ip.substring(index+1, ip.length()); } catch (Exception e) { e.printStackTrace(); } return result; } public static String getProjectURL(String IP){ String result = "http://"; result += IP; result += ":8080/"; String proPath = System.getProperty("user.dir"); String proName = proPath.substring(proPath.lastIndexOf("\\")+1, proPath.length()); result += proName; return result; } }