FAForever / downlords-faf-client

Official client for Forged Alliance Forever
https://faforever.com
MIT License
195 stars 121 forks source link

java.lang.ClassNotFoundException on Linux with v2022.11.0 #2852

Open fengelhardt opened 1 year ago

fengelhardt commented 1 year ago

Describe the bug

Running the faf-client script throws java.lang.ClassNotFoundException

To Reproduce

Adapted from the video tutorial from tatsu:

Log or error message

This is the error I get:

Error: Could not find or load main class install4j.com.faforever.client.Main
Caused by: java.lang.ClassNotFoundException: install4j.com.faforever.client.Main

Expected behavior

The FAF client should start.

OS

lsb_release -a:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:        20.04
Codename:       focal

java --version:

openjdk 17.0.5 2022-10-18
OpenJDK Runtime Environment (build 17.0.5+8-Ubuntu-2ubuntu120.04)
OpenJDK 64-Bit Server VM (build 17.0.5+8-Ubuntu-2ubuntu120.04, mixed mode, sharing)

ls -la /usr/bin/java:

lrwxrwxrwx 1 root root 22 Nov 14  2019 /usr/bin/java -> /etc/alternatives/java

ls -la /etc/alternatives/java

lrwxrwxrwx 1 root root 43 Jan  2  2022 /etc/alternatives/java -> /usr/lib/jvm/java-17-openjdk-amd64/bin/java

ls -la ~/opt/faf:

drwxrwxr-x 4 frank frank  4096 Nov 26 12:25 .
drwxrwxr-x 4 frank frank  4096 Nov 26 12:24 ..
-rwxr-xr-x 1 frank frank 12865 Nov 24 15:03 faf-client
-rw-r--r-- 1 frank frank   372 Nov 24 15:03 faf-client.vmoptions
drwxrwxr-x 2 frank frank 12288 Nov 24 15:03 lib
drwxrwxr-x 2 frank frank  4096 Nov 24 15:03 natives
-rwxrwxr-x 1 frank frank  1631 Nov 26 12:17 run
-rw-r--r-- 1 frank frank     4 Nov 24 15:03 steam_appid.txt

Thanks a lot! Frank

bukajsytlos commented 1 year ago

did you unpack it into new/clean folder?

fengelhardt commented 1 year ago

did you unpack it into new/clean folder?

Yes, this is even my first real FAF installation. I tried around a bit a year ago, but did not come this far. Could there be any residuals on my system from my previous attempt?

bukajsytlos commented 1 year ago

hm strange. I just downloaded this release from github release page, unpack and run with command as you provided (to my path java[oracle, temurin]) and it worked without issues. ClassNotFoundException evokes either wrong/incomplete archive, or when extracted to same folder as previous version something makes conflicts in libraries

fengelhardt commented 1 year ago

Btw, specifying the lib folder in the class path does also not help:

LC_ALL=C INSTALL4J_JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/ JDK_JAVA_OPTIONS="--class-path ~/opt/faf/lib"  ./faf-client

returns

NOTE: Picked up JDK_JAVA_OPTIONS: --class-path ~/opt/faf/lib
Error: Could not find or load main class install4j.com.faforever.client.Main
Caused by: java.lang.ClassNotFoundException: install4j.com.faforever.client.Main

Although I can find it here manually:

jar -tf lib/faf-client-2022.11.0-plain.jar | grep "client/Main"
com/faforever/client/Main.class
fengelhardt commented 1 year ago

Ok, had some luck with that :

java -cp lib/*:native/* com.faforever.client.Main

That brings up the launcher. Basically, I have just removed the "install4j." prefix from the class name. I did not test anything further, though. Not sure if the game runs now, but the launcher does.

Replacing install4j.com.faforever.client.Main by com.faforever.client.Main in the faf-client file also works.

bukajsytlos commented 1 year ago

that is really strange. I was confused about that install4j package prefix as well, but I assumed it's some install4j magic, because I have that in executable script and it doesn't make any issue.