package com.dsh.app.util.pay; import java.net.InetAddress; import java.net.UnknownHostException; public class PublicUtil { // public static void main(String[] args) { // System.out.println("本机的ip=" + PublicUtil.getIp()); // System.out.println("地址"+getPorjectPath()); // // System.out.println(getPorjectPath().lastIndexOf("parent")); // System.out.println("地址"+getPathHome()); // // System.out.println(QrCodeCreateUtil.getQrCode("1235", AllEnum.QrImagesType.patientCenter)); // } public static String getPorjectPath(){ String nowpath = ""; nowpath=System.getProperty("user.dir")+"\\"; return nowpath; } public static String getPathHome(){ String nowpath = ""; nowpath=System.getProperty("user.home"); return nowpath; } /** * 获取本机ip * @return */ public static String getIp(){ String ip = ""; try { InetAddress inet = InetAddress.getLocalHost(); ip = inet.getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } return ip; } }