如何选择"My Documents"路径来保存文件



我想这样做:

JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File(System.getProperty(**MY DOCUMENTS PATH **)));

我想做的就是把"我的文档"路径,它在不同的窗口版本中更改,但我不知道如何做。

我不能使用"文字路径"我需要一个相对路径,因为这个应用程序将在所有windows版本上运行,我不能使用文字路径。

据我所知,这是所有windows版本的"我的文档"路径:

String myDocumentPath = System.getProperty("user.home") + "Documents";

最新更新