in this program, im trying to select a file and read the relative path to the project of this file
FileChooser photo = new FileChooser();
Stage stage = new Stage();stage.setTitle("File Chooser Sample");
openButton.setOnAction((final ActionEvent t) -> {
File file = photo.showOpenDialog(stage);
if (file != null) {
System.out.println(file.getPath());;
}
});
the path of my project is C:\Users\151\eclipse-workspace\FlexiRentGui\
and i'm running the program in eclipse ide
when i select C:\Users\151\eclipse-workspace\FlexiRentGui\res\1.jpg
instead of printing the relative path "/res/1.jpg"
it still prints the absolute path C:\Users\151\eclipse-workspace\FlexiRentGui\res\1.jpg