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

JavaFX not in Java11 #72

Open
ppt000 opened this issue Nov 18, 2018 · 12 comments
Open

JavaFX not in Java11 #72

ppt000 opened this issue Nov 18, 2018 · 12 comments

Comments

@ppt000
Copy link

ppt000 commented Nov 18, 2018

I have the error:

Error: Could not find or load main class pl.baczkowicz.mqttspy.Main
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

and I have realised it is probably because JavaFX is not included anymore in Java11, which I run.

I don't know how to include JavaFX 11 so that it works, maybe it has to be recompiled? Can you include the necessary JavaFX classes in the jar?

@martin-ger
Copy link

Same for me with Java11 or OpenJDK even with javafx installed. Always the same error message, even after "apt-get install openjfx".

@martin-ger
Copy link

After lots of trial-and-error I think I understood, that it simply doesn't work with any Java11 version.
Going back to Java8 did the job (on Ubuntu):

sudo apt install openjdk-8-jdk
sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

@Mebus
Copy link

Mebus commented Feb 23, 2019

It doesn't work on Fedora 29:

 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.fc29.x86_64/bin/java -jar mqtt-spy-0.5.4-jar-with-dependencies.jar
Fehler: Hauptklasse pl.baczkowicz.mqttspy.Main konnte nicht gefunden oder geladen werden

Mebus

@ZoltanSzilagyiCse
Copy link

Yes, as I see Java 11 is not supported yet. Is there any plans to support Java 11 or should we move on?

@stephen-smith
Copy link

I got it to sort of work with OpenJDK 11 and OpenJFX 11 with java --module-path /usr/share/openjfx/lib --add-modules javafx.base,javafx.controls,javafx.fxml -jar mqtt-spy-1.0.1-beta-b18-jar-with-dependencies.jar, but you might need to add additional modules.

@stephen-smith
Copy link

stephen-smith commented Jun 14, 2019

Can't cheat and setAccessible() anything you want with the new module in place, even without a security manager. So java --module-path /usr/share/openjfx/lib --add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web --add-exports javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.text=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.scene.text=ALL-UNNAMED --add-opens javafx.graphics/javafx.scene.text=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.text=ALL-UNNAMED -jar mqtt-spy-1.0.1-beta-b18-jar-with-dependencies.jar is the closest I've gotten to getting it to work on Java 11.

Even then I encounter java.lang.ClassNotFoundException: com.sun.javafx.scene.control.skin.TabPaneSkin (plus associated visual problems) and javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Premature end of file. from within pl.baczkowicz.spy.ui.versions.VersionManager.loadVersions.

Also, while connecting to servers seems to work, none of my subscription tabs get updated, even when I can tell from other logs that messages were passed on those topics.

@olivm-fr
Copy link

@ppt000 JavaFX cannot really be included in the JAR (several discussions on the internet on why it is not a good idea). But, possibly, the right JRE can be bundled with the JAR to make it run, like I did on Windows here.

@stephen-smith
Copy link

stephen-smith commented Jun 30, 2019

@olivm-fr OpenFX project now recommends building it in your jar. Older versions had problems with that, but it's been well and truly separated from the JRE (as have some remaining parts of JavaEE). Since Java 9, the JavaFX website recommends including it with your application: https://openjfx.io/openjfx-docs/#modular

@iminto
Copy link

iminto commented Jul 13, 2019

when you compile a javafx application,you need javafx mods,
but when you run a javafx application,you need javafx libs,
this is the key to resolve your question.

I run it on Java 12, but it does't work well.

@hocinilotfi
Copy link

This issue can be fixed by adding the openjfx path and modules as arguments when running the javafx application, I already posted the solution on this link.
Good luck
Lotfi

@q2dg
Copy link

q2dg commented Dec 3, 2019

Last commit was 2 years ago. Maybe it's time to leave...

@heywiki
Copy link

heywiki commented Apr 21, 2020

I was not able to get it to run unter AdoptOpenJDK, even with the --module-path and --add-modules althoug i downloaded the jdk and copied the libs to the right folder and made sure that they where read correctly. So i tried out another client http://mqttfx.org/. Interestingly enough it comes with an installer like the branch of olivm-fr, https://github.com/olivm-fr/paho.mqtt-spy/releases/tag/1.0.1-proxy1, and like it, it installs an embedded java8 runtime.

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

10 participants