Imr*_*rik 1 java jfilechooser file path save
我想这样做:
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File(System.getProperty(**MY DOCUMENTS PATH **)));
Run Code Online (Sandbox Code Playgroud)
我想要做的就是放置“我的文档”路径,它会在不同的 Windows 版本中发生变化,但我不知道该怎么做。
我不能使用“文字路径”我需要一个相对路径,因为这个应用程序将适用于所有 Windows 版本,我不能使用文字路径。
据我所知,这是所有 Windows 版本的“我的文档”路径:
String myDocumentPath = System.getProperty("user.home") + "Documents";
Run Code Online (Sandbox Code Playgroud)