1

Have been trying to run my JavaFX 2.2 app in JavaFX 8 (8u5), and have consistently been encountering this error:

Caused by: javafx.fxml.LoadException: Error resolving onMouseClicked=
'#chooseClient', either the event handler is not in the Namespace or there
is an error in the script. /C:/Users/Viktor/app/bin/main/fxml/layout.fxml:301

My code seems completely fine and, most importantly, everything worked perfectly in JavaFx 2.2!! The chooseclient method that it refers to is declared as such:

@FXML protected static void chooseClient() { /* code here */ }

As hinted in this question, I did a find and replace operation to change all instances of the words 'private' and 'protected' to 'public'. No change, still got the same error.

I am exporting my application as a .jar file from eclipse and running it through the command line (Windows) with

"C:\Program Files\Java\jdk1.8.0_05\jre\bin\java.exe" -jar cClient.jar

Hitting 'run' in eclipse results in an identical error.

Running the exactly same exported jar but with JavaFx 2.2 results in no issues at all. Could this be a bug? Very confused as to what could be causing the issue. Any help is much appreciated.

Community
  • 1
  • 1
SuperMrBlob
  • 611
  • 6
  • 19
  • onMouseClicked references "chooseClientPane3" but your method is called "chooseClient". Could this be the problem? – Puce Apr 26 '14 at 16:41
  • I tried fixing the problem by removing the 'chooseclient' trigger and it then displayed the error with chooseClientPane3. I accidentally copied the error with the chooseClientPane3 instead of choose client - oops. It is still an issue though, for removing all my onactions is not a viable solution! I edited the question above, tyvm for the pickup! Any other ideas? – SuperMrBlob Apr 26 '14 at 17:18
  • I don't think it's a duplicate as the other question is about static fields and this question is about static method. Similar but not the same. – Puce Apr 27 '14 at 09:48

1 Answers1

3

I believe support for static access via @FXML disappeared in JavaFX 8. Remove the static modifier.

CAG Gonzo
  • 589
  • 1
  • 5
  • 13