How in javafx to make so that when you open the next file using fileChooser , the file selection dialog box opens in the last directory where the previous file was opened? (That is, so that fileChooser remembers the directory of the last file) wrote this, but when you reopen the file (when you call the handleOpen() function handleOpen() ), it swears, the console is all red, tell handleOpen() where the error is
String filePathName ="user.home"; @FXML private void handleOpen() { FileChooser fileChooser = new FileChooser(); // ΠΠ°Π΄Π°ΡΠΌ ΡΠΈΠ»ΡΡΡ ΡΠ°ΡΡΠΈΡΠ΅Π½ΠΈΠΉ FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter( "PDF files (*.pdf)", "*.pdf"); fileChooser.getExtensionFilters().add(extFilter); fileChooser.setInitialDirectory(new File(System.getProperty(filePathName))); // ΠΠΎΠΊΠ°Π·ΡΠ²Π°Π΅ΠΌ Π΄ΠΈΠ°Π»ΠΎΠ³ Π·Π°Π³ΡΡΠ·ΠΊΠΈ ΡΠ°ΠΉΠ»Π° File file = fileChooser.showOpenDialog(mainApp.getPrimaryStage()); if (file != null) { filePathName = file.getPath(); mainApp.loadPDFFromFile(file); labelQuantityPage.setText(Integer.toString(mainApp.getQuantityPage())); } }