JavaFX- exception in Application start method

Answered

Hi!

Have you noticed any problems in Intellij Idea connected with the newest JavaFX and Java 11(I have got both of them)? I mean, I found in a few pages that beginning from Java 11 there will be no JavaFX "inside" it, which cause that it is going to be standalone. What does it mean? 

My problem:

Location of exception: at sample.Main.start(Main.java:13)

In the beginning, IDE hadn't recognized javafx files, output had been like: javafx doesn't exist etc(import areas). I added libraries and path/ modules in VM options. Start thinking it was fixed. Nevertheless, I still can not use Java FX due to problems with the main method(screenshot attached above). I found solutions like: copy your fmxl files into the package in which your main method is currently located. In my case- both of them are in the same folder. Another source: https://teamtreehouse.com/community/how-do-i-solve-this-nullexception-in-main-method. I was trying to do it but it didn't work or, to be honest, I don't understand fully this steps. I also found a solution connected with getting a root. I changed code adding a function getClassLoader, it doesn't work as well. Maybe should I use a tool for projects like Maven? I can not find any explanation of my issue/ problem. That's why I am asking you. You can even instruct me how to properly set IDE to work with JavaFX, it doesn't matter. I am just not able to work with it and I have no idea why. That is sad :(

Thanks and regards :D

PS. Does scene builder change something? I didn't download it, but it seems that it is built-in.

1
3 comments

Please check advice from this issue: https://youtrack.jetbrains.com/issue/IDEA-200092

1
Avatar
Permanently deleted user

It helped to "deactivate" Exception but now I have an error: Error occurred during initialization of boot layer
java.nio.file.InvalidPathException: Illegal char <:> at index 78: path_to_javafx_base_module_osYOUR_PATH_SEPARATORpath_to_javafx_graphics_module:os

In that case, I decided to remove ":". It doesn't help as well due to this that now I get: Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.base not found

Deleting javafx.base create another error connected with the next module, and so on. Any module cannot be found.

That's how my VM looks like: --module-path="C:\Program Files\Java\javafx-sdk-11\lib" --add-modules=javafx.controls --add-modules javafx.base,javafx.graphics --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED -p path_to_javafx_base_module_osYOUR_PATH_SEPARATORpath_to_javafx_graphics_moduleos

Do you have any ideas? Thanks :D

0

Hello. Please follow official recommendations from https://openjfx.io/openjfx-docs/

Also please note that as Java 11 do not include JavaFX, it is recommended to use Gradle or Maven for dependency management. 

0

Please sign in to leave a comment.