edvin / fxlauncher

Auto updating launcher for JavaFX Applications
Apache License 2.0
713 stars 110 forks source link

NPE when using main method #81

Closed albertoclarit closed 7 years ago

albertoclarit commented 7 years ago

I have an NPE

screen shot 2017-07-25 at 12 24 29 pm

When I use the main method (take note of the redundant null checking on args to make sure)

screen shot 2017-07-25 at 12 25 03 pm

My Gradle config

screen shot 2017-07-25 at 12 24 48 pm

When Im not using the main method... it works fine.

edvin commented 7 years ago

You cannot use a main method with FXLauncher, you must simply point it to your application class that extends javafx.application.Application and it will do the rest, including passing any parameters if the app was started with any.

The NPE is not coming from your app class, but from the Launcher class of FXLauncher. It is telling of that the app instance couldn't be created, most likely because the class you pointed it to is either missing or it's missing a default constructor.

As the error message hints to, there is more information in the log file. I suspect you will find an error starting with "Error creating app class" there.

If this doesn't help you to resolve the issue, please post a minimal example showing the error.

albertoclarit commented 7 years ago

I finally understand it ... thanks... this issue is now closed

edvin commented 7 years ago

Great! Can you share what the problem was? :)

albertoclarit commented 7 years ago

I did not completely understand fxlauncher...

Im using your tornadofx framework and uses the main method in the guide. I thought fxlauncher supports tornadofx directly...

edvin commented 7 years ago

That's exactly what it does - it supports JavaFX and TornadoFX directly so it doesn't need a main method :)

albertoclarit commented 7 years ago

Oh yes.. I mean the package level main function...

I was try to initialize a IconFontFX and i thought i could put it in the main method.

But now I was able to do it like this

screen shot 2017-07-25 at 2 43 50 pm