您当前的位置: 首页 >  Java

柳鲲鹏

暂无认证

  • 0浏览

    0关注

    4642博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

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

柳鲲鹏 发布时间:2022-01-14 14:20:01 ,浏览量:0

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

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;
}

关注
打赏
1665724893
查看更多评论
立即登录/注册

微信扫码登录

0.0987s