Fails to find JavaFX (21, 23)
Describe the bug Even with openjfx 21 and openjfx 23 installed, mca selector fails to find it and refuses to start.
To Reproduce Steps to reproduce the behavior:
- Install jre/jdk 21
- Install openjfx 21
- Ty to start mca selector
- See JavaFX missing error
Expected behavior mca selector should be able to find and use openjfx
Screenshots and other files
Environment (please complete the following information):
- OS: Arch Linux
- Java version: 21.0.5
- Version of MCA Selector: 2.4.2
Managed to get it to work. I had to manually locate the libraries like so:
java --module-path "${JAVA_HOME}/lib/javafx.base.jar:${JAVA_HOME}/lib/javafx.fxml.jar:${JAVA_HOME}/lib/javafx.graphics.jar:${JAVA_HOME}/lib/javafx.media.jar:${JAVA_HOME}/lib/javafx.swing.jar:${JAVA_HOME}/lib/javafx.web.jar:${JAVA_HOME}/lib/javafx.controls.jar" --add-modules=javafx.base --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web --add-modules=javafx.controls -jar mcaselector-2.4.2.jar
Perhaps including a bash script that does this alongside the jar file would be a good idea.
Managed to get it to work. I had to manually locate the libraries like so:
java --module-path "${JAVA_HOME}/lib/javafx.base.jar:${JAVA_HOME}/lib/javafx.fxml.jar:${JAVA_HOME}/lib/javafx.graphics.jar:${JAVA_HOME}/lib/javafx.media.jar:${JAVA_HOME}/lib/javafx.swing.jar:${JAVA_HOME}/lib/javafx.web.jar:${JAVA_HOME}/lib/javafx.controls.jar" --add-modules=javafx.base --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web --add-modules=javafx.controls -jar mcaselector-2.4.2.jarPerhaps including a bash script that does this alongside the jar file would be a good idea.
Where can I put this code you send so it will work on my end where I am experiencing the same issue? I am on windows though is the difference.
Managed to get it to work. I had to manually locate the libraries like so:
java --module-path "${JAVA_HOME}/lib/javafx.base.jar:${JAVA_HOME}/lib/javafx.fxml.jar:${JAVA_HOME}/lib/javafx.graphics.jar:${JAVA_HOME}/lib/javafx.media.jar:${JAVA_HOME}/lib/javafx.swing.jar:${JAVA_HOME}/lib/javafx.web.jar:${JAVA_HOME}/lib/javafx.controls.jar" --add-modules=javafx.base --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web --add-modules=javafx.controls -jar mcaselector-2.4.2.jarPerhaps including a bash script that does this alongside the jar file would be a good idea.
Where can I put this code you send so it will work on my end where I am experiencing the same issue? I am on windows though is the difference.
You will have to make a .bat file to put this in. You will also have to replace the paths to resemble how they are on windows.
Does not even work either way:
java --module-path "/usr/share/openjfx/lib/javafx.base.jar:/usr/share/openjfx/lib/javafx.fxml.jar:/usr/share/openjfx/lib/javafx.graphics.jar:/usr/share/openjfx/lib/javafx.media.jar:/usr/share/openjfx/lib/javafx.swing.jar:/usr/share/openjfx/lib/javafx.web.jar:/usr/share/openjfx/lib/javafx.controls.jar" --add-modules=javafx.base --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web --add-modules=javafx.controls -jar mcaselector-2.4.2.jar
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NoSuchMethodError: 'void javafx.scene.canvas.GraphicsContext.setImageSmoothing(boolean)'
at net.querz.mcaselector.tile.TileMap.<init>(TileMap.java:119)
at net.querz.mcaselector.ui.Window.start(Window.java:48)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
... 1 more
#493
Alguém poderia me ajudar, estou com esse erro aqui
Alguém poderia me ajudar, estou com esse erro aqui
Please do not post off-topic questions, see this related issue instead: #551 (Ask there)
For Linux users
My solution was to:
- Create a
run.shwith the command mentioned by @txtsd - Install JavaFX manually by copy-paste
1. The file
The run.sh file (Marked as executable of course):
#!/bin/bash
JAVA_HOME=/lib/jvm/java-21-openjdk
java --module-path "${JAVA_HOME}/lib/javafx.base.jar:${JAVA_HOME}/lib/javafx.fxml.jar:${JAVA_HOME}/lib/javafx.graphics.jar:${JAVA_HOME}/lib/javafx.media.jar:${JAVA_HOME}/lib/javafx.swing.jar:${JAVA_HOME}/lib/javafx.web.jar:${JAVA_HOME}/lib/javafx.controls.jar" --add-modules=javafx.base --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web --add-modules=javafx.controls -jar mcaselector-2.5.3.jar
[!NOTE] My
$JAVA_HOMEvariable was not set for some reason.
2. The installation
You should download JavaFX (I've used the artifacts from GluonHQ), for your version (Mine was 21).
You'll see something like this in the .zip file:
You should unpack somewhere the lib/ folder, and then with the console copy it (You'll need root perms):
sudo cp lib/* /lib/jvm/java-21-openjdk/lib
[!WARNING] You may need to adjust the java folder, mine was
/lib/jvm/java-21-openjdk/libbut yours could be other, if you're using another jdk/jre version.You may find it using
whereis javain a console!
The thing is, that everything inside lib/ of the zip file, must end in the same lib/ folder of your java installation.
3. That's it
You should be able to run run.sh file via command ./run.sh (or double click?)
Remember to make it executable chmod +x run.sh!
I hope that this helps someone to save some minutes of googling, trying things and wasting time.
same command for windows, just extract the sdk (download) to the same folder as mcaselector
@ECHO OFF
"C:\Program Files\Java\jdk-21\bin\java.exe" --module-path .\javafx-sdk-21.0.8\lib\javafx.base.jar;.\javafx-sdk-21.0.8\lib\javafx.swing.jar;.\javafx-sdk-21.0.8\lib\javafx.graphics.jar;.\javafx-sdk-21.0.8\lib\javafx.fxml.jar;.\javafx-sdk-21.0.8\lib\javafx.media.jar;.\javafx-sdk-21.0.8\lib\javafx.web.jar;.\javafx-sdk-21.0.8\lib\javafx.controls.jar ^
--add-modules=javafx.base,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web,javafx.controls ^
-jar mcaselector-2.5.3.jar