Windows temp directory details (Java)

后端 未结 7 2235
一生所求
一生所求 2020-12-20 15:12

I\'m writing a program that needs a generic temp folder. I\'m trying to find details about the Windows Temp folders. There are two paths that I know about -

7条回答
  •  一向
    一向 (楼主)
    2020-12-20 15:26

    you can try this way

    System.out.println(File.createTempFile("temp-file", "tmp").getParent());
    String property = "java.io.tmpdir";
    String tempDir = System.getProperty(property);
    System.out.println("OS current temporary directory is " + tempDir);
    

提交回复
热议问题