【发布时间】:2017-01-11 20:07:27
【问题描述】:
我不明白为什么 System.getProperty("home.dir") 返回 null 而不是当前工作目录。
我在 Ubuntu 16.04 上使用 Eclipse Mars2.0 IDE。我想,这与我使用的 IDE 或操作系统版本无关。
package test;
public class testing {
public static void main (String args[])
{
System.out.println(System.getProperty("home.dir"));
}
}
我希望得到此代码的回报,例如 /home/[user]/Workspace/test
【问题讨论】:
-
如何去掉上面那个蓝框:“This question has already answers here:” 答案是错误的,用户主目录与工作目录是不同的概念。
标签: java