【问题标题】:How to select "My Documents" path to save a file如何选择“我的文档”路径来保存文件
【发布时间】:2015-02-26 13:35:00
【问题描述】:

我想这样做:

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

我想做的就是把“我的文档”路径,它在不同的windows版本中改变,但我不知道该怎么做。

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

【问题讨论】:

标签: java file path save jfilechooser


【解决方案1】:

据我所知,这是所有 Windows 版本的“我的文档”路径:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-01
    • 2017-01-20
    • 2019-04-30
    相关资源
    最近更新 更多