I try to write javafx application using kotlin. After I export it to runnable jar,I double click jar file but it doesn't work. But everything ok if I use Java.
For example: Create a new javafx project by IDEA 2017.2.5.Select File-Project Structure,then click JavaFX tab,Native bundle choose all.Then apply setting.

Then choose Build-Build Artifact-Build.

I can run it.Everything OK.

But when I use kotlin and do same thing as java. Everything ok when I run it in IDEA.
code:
package sample
import javafx.application.Application
import javafx.fxml.FXMLLoader
import javafx.scene.Parent
import javafx.scene.Scene
import javafx.stage.Stage
class Main : Application() {
@Throws(Exception::class)
override fun start(primaryStage: Stage) {
val root = FXMLLoader.load<Parent>(javaClass.getResource("sample.fxml"))
primaryStage.title = "Hello World"
primaryStage.scene = Scene(root, 300.0, 275.0)
primaryStage.show()
}
companion object {
@JvmStatic
fun main(args: Array<String>) {
Application.launch(Main::class.java)
}
}
}
I double click it but nothing happend.What's wrong???