Getting My Documents path in Java

后端 未结 8 1294
孤城傲影
孤城傲影 2020-12-06 04:21

I need to find my documents path using Java. The following code doesn\'t give me \"accurate\" loation

System.getProperty(\"user.home\");

What sh

8条回答
  •  失恋的感觉
    2020-12-06 04:56

    That's easy, JFileChooser finds it for you

    new JFileChooser().getFileSystemView().getDefaultDirectory().toString();
    

    I hope this helps someone

提交回复
热议问题