mcaselector icon indicating copy to clipboard operation
mcaselector copied to clipboard

Fails to find JavaFX (21, 23)

Open txtsd opened this issue 11 months ago • 9 comments

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:

  1. Install jre/jdk 21
  2. Install openjfx 21
  3. Ty to start mca selector
  4. See JavaFX missing error

Expected behavior mca selector should be able to find and use openjfx

Screenshots and other files Image

Environment (please complete the following information):

  • OS: Arch Linux
  • Java version: 21.0.5
  • Version of MCA Selector: 2.4.2

txtsd avatar Jan 22 '25 07:01 txtsd

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.

txtsd avatar Jan 22 '25 09:01 txtsd

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.

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.

TheIronPineApple avatar Jan 25 '25 00:01 TheIronPineApple

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.

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.

txtsd avatar Jan 25 '25 08:01 txtsd

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

leagris avatar Jan 25 '25 12:01 leagris

#493

ndiruhniu avatar Feb 21 '25 07:02 ndiruhniu

Alguém poderia me ajudar, estou com esse erro aqui

Image

Zaaccrz avatar Mar 09 '25 02:03 Zaaccrz

Alguém poderia me ajudar, estou com esse erro aqui

Image

Please do not post off-topic questions, see this related issue instead: #551 (Ask there)

sigmasoldi3r avatar Sep 10 '25 13:09 sigmasoldi3r

For Linux users

My solution was to:

  1. Create a run.sh with the command mentioned by @txtsd
  2. 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_HOME variable 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).

Image

You'll see something like this in the .zip file:

Image

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/lib but yours could be other, if you're using another jdk/jre version.

You may find it using whereis java in 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.

sigmasoldi3r avatar Sep 10 '25 14:09 sigmasoldi3r

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

phit avatar Sep 26 '25 13:09 phit