Linux 拨号vps windows公众号手机端

java怎么获取当前路径

lewis 8年前 (2017-01-14) 阅读数 9 #程序编程
文章标签 Java

在Java中,可以使用System.getProperty("user.dir")来获取当前工作目录的路径。示例如下:

public class GetCurrentPath {
    public static void main(String[] args) {
        String currentPath = System.getProperty("user.dir");
        System.out.println("Current working directory is: " + currentPath);
    }
}

运行该程序将会输出当前工作目录的路径。

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门