Olipro / PZHook

Java Hook for Project Zomboid
6 stars 1 forks source link

Install fails on Linux #3

Open ruffi123456789 opened 5 months ago

ruffi123456789 commented 5 months ago

Running: JAVA_HOME=/usr/lib/jvm/java-17-openjdk/ ./gradlew run

Fails on installing to the game directory with the following error:

Project : => no module-info.java found

> Task :run
null
Exception in thread "main" java.lang.ClassNotFoundException: zombie.core.Rand
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:467)
        at ZomboidJavaHook.zomboid.SteamWorkshop.main(SteamWorkshop.java:33)
Did not get success string from spawned process
java.io.IOException: Did not get success string from spawned process
        at ZomboidJavaHook.zomboid.SteamWorkshop.getWorkshopPaths(SteamWorkshop.java:74)
        at ZomboidJavaHook.zomboid.SteamWorkshop.<init>(SteamWorkshop.java:85)
        at ZomboidJavaHook.config.HookConfig.initMods(HookConfig.java:108)
        at ZomboidJavaHook.config.HookConfig.<init>(HookConfig.java:33)
        at ZomboidJavaHook.config.HookConfig.<init>(HookConfig.java:42)
        at ZomboidJavaHook.ui.UIManager.main(UIManager.java:77)
        at ZomboidJavaHook.Main.main(Main.java:10)
/home/acesls/Workspace/PZHook/build/classes/java/main (Is a directory)
java.io.FileNotFoundException: /home/acesls/Workspace/PZHook/build/classes/java/main (Is a directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at ZomboidJavaHook.installer.HookInstaller.install(HookInstaller.java:120)
        at ZomboidJavaHook.ui.UIManager.installHook(UIManager.java:127)
        at ZomboidJavaHook.ui.UIManager.initedGamePath(UIManager.java:120)
        at ZomboidJavaHook.ui.UIManager.start(UIManager.java:176)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
        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:290)
        at java.base/java.lang.Thread.run(Thread.java:840)
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:901)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "ZomboidJavaHook.config.HookConfig.setUserCancelled()" because "ZomboidJavaHook.ui.UIManager.cfg" is null
        at ZomboidJavaHook.ui.UIManager.start(UIManager.java:179)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
        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:290)
        ... 1 more

> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-17-openjdk/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 44s
7 actionable tasks: 4 executed, 3 up-to-date

I checked the game directory and the Rand.class is at ProjectZomboid/projectzomboid/zombie/core/Rand.class, where it should be.

It also creates a ~ directory in the projects root dir, seems like ~ doesn't get properly expanded everywhere (it does in the GUI though). Hardcoding the PZGameDir seems to fix the latter, but the error remains the same

Following through with the manual installation gets this error on startup:

Caused by: java.lang.ClassNotFoundException: ZomboidJavaHook.zomboid.SteamWorkshop
Did not get success string from spawned process
java.io.IOException: Did not get success string from spawned process
    at ZomboidJavaHook.zomboid.SteamWorkshop.getWorkshopPaths(SteamWorkshop.java:74)
    at ZomboidJavaHook.zomboid.SteamWorkshop.<init>(SteamWorkshop.java:85)
    at ZomboidJavaHook.config.HookConfig.initMods(HookConfig.java:108)
    at ZomboidJavaHook.config.HookConfig.<init>(HookConfig.java:33)
    at ZomboidJavaHook.config.HookConfig.<init>(HookConfig.java:42)
    at ZomboidJavaHook.ui.UIManager.main(UIManager.java:77)
    at ZomboidJavaHook.Main.main(Main.java:10)
Jul 01, 2024 1:23:09 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @71c7db30'
Cannot invoke "ZomboidJavaHook.config.HookConfig.getMods()" because "cfg" is null
java.lang.NullPointerException: Cannot invoke "ZomboidJavaHook.config.HookConfig.getMods()" because "cfg" is null
    at ZomboidJavaHook.ui.ModsDialogController.setConfig(ModsDialogController.java:37)
    at ZomboidJavaHook.ui.UIManager.lambda$showModsDialog$7(UIManager.java:163)
    at ZomboidJavaHook.ui.UIManager.showStage(UIManager.java:141)
    at ZomboidJavaHook.ui.UIManager.lambda$showModsDialog$8(UIManager.java:163)
    at ZomboidJavaHook.config.TrustedDigests.transaction(TrustedDigests.java:46)
    at ZomboidJavaHook.ui.UIManager.showModsDialog(UIManager.java:162)
    at ZomboidJavaHook.ui.UIManager.start(UIManager.java:177)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
    at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:290)
    at java.base/java.lang.Thread.run(Unknown Source)
Olipro commented 3 months ago

I have only tested running the application on Windows. There are likely some tweaks required to the build.gradle file.

Since you are playing the game on a Linux platform, if you are able to identify and apply the needed changes, a PR would be great.