getting-started icon indicating copy to clipboard operation
getting-started copied to clipboard

Location is not set

Open AhmedAGH opened this issue 6 years ago • 2 comments

Hi, I have used netbeans instead of eclipse for the project, but I have followed everything mentioned in the tutorial. Yet I get a "Location is not set" error, and here is a printscreen of what I am seeing exactly. Can I know why is the error being caused since I do not really get it and how can it be fixed. Error Edited: I have created another package for the utils.Utils but I assume that has nothing to do with it.

AhmedAGH avatar Apr 19 '19 20:04 AhmedAGH

Hi @AhmedAGH,

that error is typically related to a wrong path declared for the FXMLLoader:

FXMLLoader loader = new FXMLLoader(getClass().getResource("FXHelloCV.fxml"));

Is the FXHelloCV.fxml file still in the same package of FXHelloCV.java? Does it have the same name? Otherwise, you need to change the previous line to match your project...

luigidr avatar Apr 23 '19 12:04 luigidr

Hello, I have the same issue, I moved le .fxml file into the same package but still say "Location is not set".

This is my project architecture: image

I also cloned the project, but Eclipse doesn't find the packages and want me to create a project...

Edit: I resolved it thanks to that post. I put application.css and FXHelloCV.fxml into src/main/resources/, so these files/resources are copied in target/classes/ during compilation. Then in the code you have to add "/" to the file path: FXMLLoader loader = new FXMLLoader(getClass().getResource("/FXHelloCV.fxml"));.

rafutek avatar Jun 21 '19 07:06 rafutek