JavaFX and Groovy Exception

You might have tried out the JavaFX Hello World example, from Oracle’s Getting Started with JavaFX guide, using Groovy.

You will then get the following exception:


Exception in thread "main" java.lang.RuntimeException: Error: class sun.reflect.NativeMethodAccessorImpl is not a subclass of javafx.application.Application

In order to fix this, change

launch(args);

to

launch(HelloWorld.class, args);

The example now runs fine with Groovy.