package com.brilliant.common.tool;
public class Path {
public static void main(String[] args) {
String returns = getPorjectPath();
//System.out.println(returns);
}
//获取当前项目的绝对路径
public static String getPorjectPath(){
String projectName="#####"; // 你项目的名称
String nowpath; //当前tomcat的bin目录的路径 如 D:\java\software\apache-tomcat-6.0.14\bin
String tempdir;
nowpath=System.getProperty("user.dir");
tempdir=nowpath.replace("bin", "webapps"); //把bin 文件夹变到 webapps文件里面
//tempdir+="\\"+projectName; //拼成D:\java\software\apache-tomcat-6.0.14\webapps\sz_pro
return tempdir;
}
}
获取tomcat地址
最新推荐文章于 2023-09-11 19:47:54 发布