I\'m using IntelliJ IDEA 13.1.5, I used to work with Eclipse. I\'m working on JavaFX application, I try to load FXML file within my MainApp class using getClass().getResourc
Put your resources in resources folder.
Use them with one slash before their names: getClass().getResource("/myfont.ttf");
If you are using Intellij IDEA and you created a Maven project, you should put your resources in resources folder (as marked as resource root by intellij itself) and these resource go to the root of your compiled app.
I mean, /resources/myfont.ttf will go to /myfont.ttf in the resulting build.
So you should get it via /myfont.ttf and not myfont.ttf. Use it like this:
getClass().getResource("/myfont.ttf");
No need to change anything else. Just this one helped me.