edvin / fxlauncher

Auto updating launcher for JavaFX Applications
Apache License 2.0
715 stars 107 forks source link

Launcher always tries to execute non javafx launchers #105

Closed errfld closed 6 years ago

errfld commented 6 years ago

fxlauncher tries to start every application as non javafx application since 1.0.19. This behaviour can be reproduced with fxldemo and changing fxlauncher version to 1.0.19 in pom.xml.

logging to /var/folders/vd/kllktb9514n84bzf3tmb6jt80000gn/T//fxlauncher.log
Mar 15, 2018 2:06:32 PM fxlauncher.AbstractLauncher syncFiles
INFORMATION: Using cache dir /Users/er/Library/Application Support/FxlDemo
Mar 15, 2018 2:06:33 PM fxlauncher.Launcher launchAppFromManifest
INFORMATION: Show whats new dialog? true
Mar 15, 2018 2:06:33 PM fxlauncher.Launcher startApplication
INFORMATION: Execute command 'java -jar USERLIB/FxlDemo/fxldemo-2.0.jar'

This seems to conform with changes on #96. I debuged the changes and came down to Launcher.java

        @Override
        protected void createApplication(Class<Application> appClass) {
            PlatformImpl.runAndWait(() ->
            {
                try {
                    if (appClass.isAssignableFrom(Application.class)){
                        app = appClass.newInstance();
                    }
                } catch (Throwable t) {
                    reportError("Error creating app class", t);
                }
            });
        }

As there is no new instance build by appClass I guess it should be:

java Application.class.isAssignableFrom(appClass)

edvin commented 6 years ago

You're completely correct. I'll fix that ASAP. Thanks for reporting and debugging.

edvin commented 6 years ago

This has been fixed, I'll release a new version tomorrow :)

mkotsovoulou commented 6 years ago

Is it fixed? I face the same problem after updating to version 1.0.19 when I go back to 1.0.16 that I had before the error disappears...

edvin commented 6 years ago

Thanks for reporting @mkotsovoulou - I will investigate tomorrow morning and let you know!