X is not a subclass of javafx.application.Application

506 views
Skip to first unread message

Robert Krüger

unread,
Apr 6, 2015, 7:32:11 AM4/6/15
to rob...@googlegroups.com
Hi,

I am trying to get my first gradle build for mx JFX iOS app to run.

I set up the code as in the Contractr FX iOS example, i.e.

---

public class MyIOSApp extends UIApplicationDelegateAdapter {

    public static class MyIOSJFXApplication extends MyJFXApplication{
 
...
    }

..
    public boolean didFinishLaunching(UIApplication application,
                                      UIApplicationLaunchOptions launchOptions) {

        Thread launchThread = new Thread() {
            @Override
            public void run() {
                Application.launch(MyIOSJFXApplication.class);
            }
        };
        launchThread.setDaemon(true);
        launchThread.start();

        return true;
    }

    public static void main(String[] args) throws Exception {
        try (NSAutoreleasePool pool = new NSAutoreleasePool()) {
            UIApplication.main(args, null, MyIOSApp.class);
        }
    }
}

---

The error I get launching is:

 Error: MyIOSApp is not a subclass of javafx.application.Application

Of course it isn't because it's the UIApplicationDelegateAdapter implementation.

In my gradle build file I have this:

apply plugin: 'org.javafxports.jfxmobile'

mainClassName = 'my.package.MyIOSApp'

Now, it looks as if the mainClassName is that what is checked for being a subclass of javafx.application.Application, which I find surprising, because I thought the Application class was specified programatically in the code above.

Am I confusing things here? 

Is there any example of a working JFX iOS gradle build setup? In the robovm samples I could only find Contractr but that is maven-based.

And I am still unsure if the jfxmobile and the robovm plugin and are alternatives for each other and I am mixing up stuff here. If robovm can do that for me, i.e. build an iOS JFX application, I want to do it the robovm way but where can I find how?

Thanks,

Robert


Niklas Therning

unread,
Apr 7, 2015, 4:09:39 AM4/7/15
to Robert Krüger, rob...@googlegroups.com
You are mixing the old way (using your own launcher which extends from UIApplicationDelegateAdapter) and the new way (using jfxmobile). With the jfxmobile Gradle plugin you only have to specify a mainClassName in your Gradle file and the launcher class provided by the plugin will be used. The class you specify as mainClassName is the class which extends from javafx.application.Application.

--
You received this message because you are subscribed to the Google Groups "RoboVM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robovm+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages