Home > Mobile >  How build EXE from TornadoFX JAR?
How build EXE from TornadoFX JAR?

Time:10-26

I have a simple JavaFX/TornadoFX project on Windows that builds in a JAR and runs correctly from under IntelliJ IDEA and in the JRE installed on my computer. I want to make it so that this project can run on any Windows machine without JRE installed. To do this, in IntelliJ, I created an artifact "JavaFx application" and configured it as it is written in the instructions for TornadoFX.

project settings

project settings

The executable file builds successfully, but when I try to run it I get the error "No method main in class com/example/demo/app/MyApp."

I tried to add main to the project code, as it is written in the instructions for TornadoFX, but I cannot specify this method in the project settings.

project settings

Only the MyApp class can be added automatically, but of course it does not contain the main method.

project settings

What am I doing wrong and how can I make an executable file under Windows?

My code in MyApp.kt:

package com.example.demo.app

import com.example.demo.view.MainView
import tornadofx.App
import tornadofx.launch

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

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

CodePudding user response:

Once again I carefully re-read the manual for TornadoFx and saw the important phrase: "Notice the Kt at the end.". Thus, in the project settings in the Application class field, you need to add "Kt" by hand. I did it and it worked out as I wish.

  • Related