Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying specific build directory location for FXML.load()? #157

Closed
LeeEnHao opened this issue Sep 1, 2020 · 5 comments
Closed

Specifying specific build directory location for FXML.load()? #157

LeeEnHao opened this issue Sep 1, 2020 · 5 comments

Comments

@LeeEnHao
Copy link

LeeEnHao commented Sep 1, 2020

Every time I run gradle build, the view directory which I placed the fxml files appears in build/resources/main instead of build/classes/java/main is there any way to change the gradle setting for this. It is causing the FXML.load() to load the fxml files in a directory that does not exist in build/classes/java/main
Screenshot (2)

This is my source tree.

ip
└───src
    └───main
        |___images
        |     .png files
        | 
        |───java
        |       .java files and packages
        |_____test
        |
        └───resources
              |_______view
                        MainWindow.fxml
                        DialogBox.fxml

This is the build/out tree:

build
└───classes
 |    └───java
 |      |____test
 |      |
 |      |───main
 |         .class files and packages
 |      
 |______resources
       |______view
                  MainWindow.fxml
                  DialogBox.fxml     

In the out tree the fxml file is out side of the project root which is have confirmed to be build/classes/java/main. This is causing the fxml.load to be unable to find /view/*.fxml files. How do I resolve this?

@LeeEnHao
Copy link
Author

LeeEnHao commented Sep 1, 2020

Issue resolved.

@LeeEnHao LeeEnHao closed this as completed Sep 1, 2020
@khoongwk
Copy link

Hi En Hao,

I am facing the same issue as you - my resources directory is not being built in the src/main folder. May I ask how you managed to solve this?

@LeeEnHao
Copy link
Author

LeeEnHao commented Sep 14, 2020

Hi En Hao,

I am facing the same issue as you - my resources directory is not being built in the src/main folder. May I ask how you managed to solve this?

Hi, I think my issue was caused by the fx:controller to be set to just MainWindow when in fact I packaged MainWindow within another sub directory. You can try setting the fx:controller to <yourpackages.....>.MainWindow

@khoongwk
Copy link

Thanks for the comment En Hao, I have solved my issue at #213 .

@GeNiaaz
Copy link

GeNiaaz commented Oct 4, 2020

@LeeEnHao Hi EnHao, I am facing an issue regarding my fxml files too. They are created when the project is built, can I ask where exactly it is constructed? I'm not sure about this and have been trying to solve this issue for ages.

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

No branches or pull requests

3 participants