Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run a quarkus-fx-based app with jpro #179

Open
hallvard opened this issue Jul 11, 2024 · 5 comments
Open

Cannot run a quarkus-fx-based app with jpro #179

hallvard opened this issue Jul 11, 2024 · 5 comments

Comments

@hallvard
Copy link

I'm trying out Quarkus as a platform for Java desktop apps. It has an extension named quarkus-fx, that allows the quarkus platform and javafx application to work together. However, in such an application the main application class must implement QuarkusApplication instead of subclassing of javafx' Application class, so cannot be started by jpro:

@QuarkusMain
public class WbApplication implements QuarkusApplication {

    @Override
    public int run(final String... args) {
        Application.launch(FxApplication.class, args);
        return 0;
    }

    public static void main(String[] args) {
        Quarkus.run(WbApplication.class, args); 
    }
}

It's the FxApplication (library) class that extends Application, not WbApplication.

Quarkus and quarkus-fx is an interesting platform, so perhaps jpro could support it?

@FlorianKirmaier
Copy link
Contributor

Hi hallvard!

First, thank you for mentioning this issue.
It's, of course, important for us to support all reasonable JavaFX environments.

In my first analysis, I noticed a more fundamental issue.
There are solutions to work around the "Application" issue.
However, the real issue is that Quarkus "reloads" all classes using a new Classloader.
JavaFX is loaded twice.
Quarkus uses it's reloaded JavaFX Classes. JPro uses the original JavaFX Classes.
The solution would probably be to "replace" the current JPro Startup Mechanism, and move it into the Quarkus Classloader.

It probably sounds more complicated as it is.

@FlorianKirmaier
Copy link
Contributor

@hallvard
We just made a prototype working.
It required some changes in JPro itself.
We have to clean it up.
Then, we can make it available as a sample
We can probably give you something at the beginning of next week.

@hallvard
Copy link
Author

hallvard commented Jul 11, 2024

Wow, that was quick! Looking forward to testing it!

Btw, here's the app I wanted to try out: https://github.com/hallvard/wb-fx

@FlorianKirmaier
Copy link
Contributor

FlorianKirmaier commented Jul 17, 2024

Small minimal "Quarkus JPro Helloworld":
https://github.com/FlorianKirmaier/jpro-quarkus

But there are currently quite some issues.
Quarkus does a LOT of Classloader and deployment magic. It also has it's own dependency resolver.
In this version, only running works, deployment doesn't work now.

It also only works with the special JPro Version used in this example.

It is also worth noting that you have to change the JavaFX version in the pom to the one JPro uses.
<javafx.version>21.0.3-jpro</javafx.version>
Quarkus seems to ignore the classpath JPro provides, so it only accepts it, when its written in the pom.

@FlorianKirmaier
Copy link
Contributor

FlorianKirmaier commented Jul 17, 2024

Screenshot 2024-07-17 at 21 48 54

I quickly tested your application.
Seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants