superzanti / ServerSync

Sync files between client and server for Minecraft Forge
GNU General Public License v3.0
160 stars 26 forks source link

Start error when trying to launching ServerSync with AdoptOpenJDK 8 #247

Open vico93 opened 3 years ago

vico93 commented 3 years ago

Serversync Version: serversync-4.0.0.jar

Minecraft Version: 1.12.2 (Forge 14.23.5.2855)

Issue:

I just downloaded OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode) from AdoptOpenJDK and i tried to launch ServerSync using that version.

Launching the server-side mode works, but when i try to launch the client i get this error:

Using java -jar serversync-4.0.0.jar
[fev 27, 2021 2:44:48][ServerSync] INFORMAÃıES: Root dir: D:\Desktop\teste
[fev 27, 2021 2:44:48][ServerSync] INFORMAÃıES: Running version: v4.0.0
[fev 27, 2021 2:44:48][ServerSync] INFORMAÃıES: Loading language file: en_US
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: javafx/application/Application
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at com.superzanti.serversync.ServerSync.lambda$runInClientMode$6(ServerSync.java:168)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 14 more

The ServerSyncClient.exe does nothing when double-clicked (checked for SmartScreen and such, nothing blocking the executable).

Launching the client usingt the stock Java8 shipped with Mojang's official launcher works, but depending of the button i click on the interface (or if i try to sync often) leads to this:

Warning which appears when running serversync with Mojang's internal JRE
Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: tried to access method javafx.scene.control.TableView.refresh()V from class com.superzanti.serversync.GUIJavaFX.PaneSync
        at com.superzanti.serversync.GUIJavaFX.PaneSync.lambda$null$6(PaneSync.java:251)
        at com.superzanti.serversync.GUIJavaFX.PaneSync$$Lambda$483/1191499501.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
        at com.sun.javafx.application.PlatformImpl$$Lambda$62/1972073718.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
        at com.sun.javafx.application.PlatformImpl$$Lambda$61/255541852.run(Unknown Source)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
        at com.sun.glass.ui.win.WinApplication$$Lambda$50/198377941.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)

Trying to launch the jar using Java 11 doesnt work.

What i'm doing wrong this time?

TheRealVincentVanGogh commented 3 years ago

Most likely related to this: https://askubuntu.com/a/1138493

vico93 commented 3 years ago

So... do i need to install java fx? i searched in AdoptOpenJDK folder to see if there is anything related to JavaFX and cant find anything related

aMerryElk commented 3 years ago

I'm having the same issue with OpenJDK on Arch Linux. It would seem JavaFX is a requirement, though I think it would be best if it was packaged together with the .jar, as I cannot expect that every client player will have or know how to install JavaFX.

For now the solution I found was running the client in headless mode with the --silent flag. @vico93

TheRealVincentVanGogh commented 3 years ago

Yeah, the easiest solution is running with the silent flag. I'm trying to compile with intellij's JavaFX packaging but I'm having trouble understanding what's going on, since I haven't touched java in a while. I'll post back here if I make any progress.

rheimus commented 3 years ago

JavaFX is indeed a requirement at the moment (for GUI).

I'll look into adding it to the package though presumably this will skyrocket the jar size.

rheimus commented 3 years ago

Also this may be of interest to the OP https://adoptopenjdk.net/faq.html?variant=openjdk8&jvmVariant=hotspot#openjfxfaq

vico93 commented 3 years ago

Also this may be of interest to the OP https://adoptopenjdk.net/faq.html?variant=openjdk8&jvmVariant=hotspot#openjfxfaq

Yeah, sad OpenJDK had this decision. It's partially comprehensive from their standpoint, but i'm not going to install the crap Oracle JDK here. Will run the client in headless mode and wait for the alternative jar with bundled JavaFX (for me particulary the size increase isn't a hurdle).

Should i leave the issue open?

rheimus commented 3 years ago

Yeah I'll use this one as the task to investigate FX packaging, I had a brief look and it seems like I may end up having to bundle the entire JVM as well 🤔

vico93 commented 3 years ago

If i had time and knowledge i would try to help making a native app for (at least) Windows. I have distant knowledge of Delphi/Lazarus but not enough to implement the concept of ServerSync using it.

rheimus commented 3 years ago

Would probably be better off just making an electron app if you were going down the rewrite path.