1

Today when I was working on Windows, there was no problem at all. After transferring to my Mac at home, trouble started.

I have the following path in the FXML (BorderPane):

fx:controller="application.controllers.DashboardController"

The directory structure looks like this:

enter image description here

Eclipse keeps saying that 'the controller has no field XXX'.

enter image description here

It seems to me quite clear that they are there!

enter image description here

The interface gets properly loaded when run, I'm quite sure the path is correct.
However, the controller is not recognised, and 'test' doesn't get printed.

Any hints?

1 Answer 1

1

FXML loader and IDEs (e.g. Eclipse) use reflection to retrieve information about the controller. In your case you seem to have an inner class PleaseProvideControllerClassName where the annotated fields are. Hence, from reflection's perspective the DashboardController class itself does not contain any fields at all.

It's worth noting that nested classes should not be used in controllers.

Sign up to request clarification or add additional context in comments.

1 Comment

Wow man, I've got no idea how it got there and even less how I looked over it. Must have been staring for too long today. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.