Search code examples
kotlinjavafxtornadofx

How to start a TornadoFX app from a launcher class


It's well known that for a fatjar to run properly for more recent versions of javafx applications the main class that launches the application cannot inherit from the Application class. The easy work around is creating a launcher class that calls the main method of the main class.

I'm having trouble doing this with Kotlin and TornadoFX (pretty new to both).

My example app is minimal:

class MyApp: App(MainView::class, Styles::class) 

The question is how can I start this class from another launcher class?


Solution

  • What I've done is put the function:

    fun main(args: Array<String>) {
        launch<MyApp>(args)
    }
    

    In the same file, but outside of the App class. I then have my IDE and build tool (Maven in my case) point to this file.