我尝试过的:
类 TempDir {
公共(public)静态无效主(字符串[] args){
System.out.println(System.getProperty("java.io.tempdir"));
}
}
我需要保持脚本与 Windows 和 Linux 一致,Windows 返回临时目录,但是 ubuntu 返回 null,我不知道为什么?
最佳答案
System.out.println(System.getProperty("java.io.tmpdir"));
在我的 Ubuntu 系统上打印/tmp,因此看起来您拼错了属性名称。
关于Java io.tempdir 在 ubuntu 上返回 null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35709845/