0
点赞
收藏
分享

微信扫一扫

JAVA:获得当前执行路径的办法

罗蓁蓁 2022-01-27 阅读 87


  比如吾在开发时调试功能,当前路径是哪个?有点明白,也不确定。这个时候,还是老老实实的检查一下:

public static String getCurrentRunningDir()
{
File f = new File("");
try
{
String dir = f.getCanonicalPath();
System.out.println("Current Dir:"+dir);
return dir;
}
catch (IOException e)\
{
e.printStackTrace();
}
return null;
}


举报

相关推荐

0 条评论