Set program's directory as the initial directory of JavaFX FileChooser

Viewed 3314

I am using JavaFX. I would like to start a FileChooser from the directory of the program, the initial repository should therefore be that of the program.

Here is my FileChooser declaration:

FileChooser chooser = new FileChooser();
chooser.getExtensionFilters().addAll(
new ExtensionFilter("Text Files", "*.txt"),
new ExtensionFilter("All Files", "*.*"));
chooser.setTitle("Choisir un fichier");
file = chooser.showOpenDialog(new Stage());

How can I do that?

1 Answers
Related