3arthqu4ke / headlessmc

Minecraft on the command line
https://3arthqu4ke.github.io/headlessmc/
MIT License
155 stars 18 forks source link

logging in via webview doesn't work #89

Closed realRobotix closed 11 months ago

realRobotix commented 1 year ago

when trying to login with webview the launcher crashes tried with both java 8 & 17:

java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
    at fr.litarvan.openauth.microsoft.MicrosoftAuthenticator.loginWithAsyncWebview(MicrosoftAuthenticator.java:151)
    at fr.litarvan.openauth.microsoft.MicrosoftAuthenticator.loginWithWebview(MicrosoftAuthenticator.java:138)
    at me.earth.headlessmc.launcher.auth.AccountManager.loginWithWebView(AccountManager.java:69)
    at me.earth.headlessmc.launcher.command.login.LoginCommand.loginWithWebView(LoginCommand.java:75)
    at me.earth.headlessmc.launcher.command.login.LoginCommand.execute(LoginCommand.java:25)
    at me.earth.headlessmc.command.CommandContextImpl.executeCommand(CommandContextImpl.java:44)
    at me.earth.headlessmc.command.CommandContextImpl.execute(CommandContextImpl.java:31)
    at me.earth.headlessmc.command.line.ConsoleListener.listen(ConsoleListener.java:22)
    at me.earth.headlessmc.command.line.CommandLineImpl.listen(CommandLineImpl.java:26)
    at me.earth.headlessmc.launcher.Main.runHeadlessMc(Main.java:90)
    at me.earth.headlessmc.launcher.Main.main(Main.java:35)
Caused by: java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
    ... 11 more
$ java -version
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+8)
OpenJDK 64-Bit Server VM (build 17.0.9+8, mixed mode)
$ java -version
openjdk version "1.8.0_392"
OpenJDK Runtime Environment (build 1.8.0_392-b08)
OpenJDK 64-Bit Server VM (build 25.392-b08, mixed mode)
$ uname -nr
archlinux 6.5.8-arch1-1

I got it to work in dev environment by adding the javafx plugin and using it to add the missing libs but couldn't get it working when building a jar.

3arthqu4ke commented 1 year ago

You can try installing a JDK 8, JavaFX seems to come with the one I have currently installed (1.8.0_371). Besides that I might look into either bundling JavaFX into the jar, ~or changing the webview so that it does not need to rely on JavaFX.~ (webview is a feature of JavaFX)