• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

FXML Load exception when inserting data of own class into tableview  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem again. I am trying to understand FXML and I am currently using the "Mastering FXML" guide of oracle "creating an address book with FXML". I am pretty near at the end of the guide but i am not able to fix a problem I have since yesterday. I want to write a Maintenance Program for my father but I am always getting the statement:
javafx.fxml.LoadException: Maintenance is not a valid type.
there are 3 classes that are important for this problem I guess. That would be my "mainLayout.fxml", "FXMLDocumentController.java" and "Maintenance.java" So I am just posting them in this order.

I have not found a sample for FXML Code Style so i am just posting it as Java..
mainLayout.FXML


FXMLDocumentController.java



Maintenance.java


insertwindow.fxml is existing and worked great so far so I won't post it to shorten my post same for main.java and my 4 property files. Hope someone can tell me what I am doing wrong again. Thanks for help!
 
Ranch Hand
Posts: 161
5
MS IE Notepad Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use an ide with a gui builder and let it generate it - pretty much like android: nice it's backed by xml but to complicated to write it by yourself - it simply forces you to use some auto-generator stuff
 
Domenik Steckling
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i made the fxml file with Scenebuilder and it worked until i tried to insert data into it
 
Marshal
Posts: 5987
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, we need to know the error and the full error message to be able to help.  Please copy and paste it in a post.
 
Knute Snortum
Marshal
Posts: 5987
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Domenik Steckling wrote:i made the fxml file with Scenebuilder and it worked until i tried to insert data into it


That probably doesn't have anything to do with Scene Builder.
 
Domenik Steckling
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know it hastn anything to do with scenebuilder.. just said it cause one guy mentioned ide with gui builder

Error message:

 
Knute Snortum
Marshal
Posts: 5987
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the important part of the error message:

   WARNING: Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.202

It means that the FXML has a version of 10 but your executing it with Java 8.  The easiest thing to do is to edit the FXML with a text editor and change the version -- assuming you haven't used any Java 9 or 10 syntax.  The long-time solution is to make sure you are using version 8 of Scene Builder.

So despite our protestation, it was Scene Builder!  Sort of.
 
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Knute Snortum wrote:This is the important part of the error message:

   WARNING: Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.202

It means that the FXML has a version of 10 but your executing it with Java 8.  The easiest thing to do is to edit the FXML with a text editor and change the version -- assuming you haven't used any Java 9 or 10 syntax.  The long-time solution is to make sure you are using version 8 of Scene Builder.

So despite our protestation, it was Scene Builder!  Sort of.


That dosn't mather (or it does, but is not causing the program to fail), the message is a warning, not an error
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would remove the part where you set your data out of your fxml and do that in your controller.



I don't know how your calling this method but you don't need een actionEvent, in your fxml add to the component tag onaction (or whatever you use, onEdit idk)="#methodName"
Do you use css files? otherwise setting an id on an component dosn't do mutch, the id is for css purposes, the fx:id to refference in the controler.
You also use a lot of unneeded default tags (like childern, columns, content)
One thing I also notice in your fxml you say <items>observableArrayList</items>. I think it expect the name of the list, not what you use to fill it, since an tableview already expect the data to be in an observableList
 
Domenik Steckling
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so i got it.. all i had to do was import my maintenance.java into the fxml file. So it accepts that part now, still got another error i dont know things about.



thats the new error.

And yes, i use a css file and 4 property files for language support
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your classpath is broken or you missing an dependency
 
Domenik Steckling
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so how can i fix that`?
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it would be an dependency the name would be after the eroormessage and you have to manually add the jar to the classpath. Otherwise to set the classpath you can have a look at this link. Basicly you go to the package before the package containing the missing claas and run java -cp package classname, if it dosn't return a package, go inside the package containing the class and run java -cp classname.
The documentation might explain it a bit more clearer
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!