Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

Location is not set #14

Open
AhmedAGH opened this issue Apr 19, 2019 · 2 comments
Open

Location is not set #14

AhmedAGH opened this issue Apr 19, 2019 · 2 comments

Comments

@AhmedAGH
Copy link

AhmedAGH commented Apr 19, 2019

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.

@luigidr
Copy link
Member

luigidr commented Apr 23, 2019

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...

@rafutek
Copy link

rafutek commented Jun 21, 2019

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"));.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants