Paulo Cereda
02/28/2025, 4:31 PMfun main(args: Array<String>) = runCatching { println("Hello world") }
When I ran it, I got
Error: Main method not found in class org.example.MainKt, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
I then realized my main
is not returning void/Unit
but Result<Unit>
. Adding
fun main(args: Array<String>) = runCatching { println("Hello world") }.getOrThrow()
or anything that would return Unit
makes the signature match and it works. 🙂Jana Fürchtenicht
02/28/2025, 5:12 PMJana Fürchtenicht
02/28/2025, 5:14 PMPaulo Cereda
02/28/2025, 9:29 PM