jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Jabref does not run with gradle on Fedora and Nobara

Open ThiloteE opened this issue 1 year ago • 11 comments

JabRef version

Latest development branch build (please note build date below) 2024-07-07 with commit b91e030349959c6b7998942bac75a289f3d8cd72

JabRef 5.14 JabRef 5.13 JabRef 5.12 JabRef 5.11

Operating system

GNU / Linux

Details on version and operating system

Fedora 40, KDE Plasma 6.1.1, Kernel 6.9.7-200, Wayland

Checked with the latest development build (copy version output from About dialog)

  • [X] I made a backup of my libraries before testing the latest development version.
  • [X] I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

Description:

JabRef does not compile with gradle on Fedora and Nobara (Fedora based distribution).

How to reproduce:

  1. Get the JabRef code into your local workspace as described in the devdocs
  2. Open folder with JabRef code.
  3. Open the commandline
  4. Use following command: ./gradlew run

Notes:

JavaFXreproducer does compile.

Appendix

...

Log File
$ ./gradlew run

> Configure project :
Project : => 'org.jabref' Java module

> Task :run
Messages are not initialized before accessing key: Display help on command line options
2024-07-08 23:37:05 [main] org.jabref.Launcher.clearOldSearchIndices()
INFO: Deleting out-of-date fulltext search index at /home/thilo/.local/share/jabref/lucene/95.
2024-07-08 23:37:05 [JavaFX Application Thread] org.jabref.gui.theme.ThemeManager.addStylesheetToWatchlist()
INFO: Watching css /home/thilo/Prog/Development/JabRef-JabRef_JabRef/JabRef/build/resources/main/org/jabref/gui/Base.css for live updates
2024-07-08 23:37:05 [JavaFX Application Thread] org.jabref.gui.theme.ThemeManager.updateThemeSettings()
INFO: Not updating theme because it hasn't changed
2024-07-08 23:37:05 [JavaFX Application Thread] org.jabref.gui.theme.ThemeManager.updateThemeSettings()
INFO: Theme set to Theme{type=DEFAULT, name=''} with base css StyleSheet{file:/home/thilo/Prog/Development/JabRef-JabRef_JabRef/JabRef/build/resources/main/org/jabref/gui/Base.css}
Exception in Application start method
2024-07-08 23:37:07 [main] org.jabref.Launcher.main()
ERROR: Unexpected exception: java.lang.RuntimeException: Exception in Application start method
        at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:893)
        at [email protected]/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.awt.HeadlessException: 
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,

        at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
        at java.desktop/java.awt.Toolkit.getSystemSelection(Toolkit.java:1037)
        at [email protected]/org.jabref.gui.ClipBoardManager.<init>(ClipBoardManager.java:42)
        at [email protected]/org.jabref.gui.JabRefGUI.initialize(JabRefGUI.java:151)
        at [email protected]/org.jabref.gui.JabRefGUI.start(JabRefGUI.java:86)
        at [email protected]/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
        at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at [email protected]/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at [email protected]/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java:264)
        ... 1 more

BUILD SUCCESSFUL in 9s
9 actionable tasks: 1 executed, 8 up-to-date

ThiloteE avatar Jul 08 '24 21:07 ThiloteE

Seems to be an awt issue with the clipboard manager

Siedlerchr avatar Jul 09 '24 04:07 Siedlerchr

Now the "fun" part of Software Engineering starts... Systematic trial and error. To state which variant works and which doesn't. We already learned that the javafxreproducer starts.

Googling found following hints:

https://stackoverflow.com/a/75931990/873282 - it might really be that the gradle Toolchain picks up a non-wanted JDK. Are there any logs when running ./gradlew --info run? I mean: Is it output which JDK is used?

https://www.baeldung.com/linux/no-x11-display-error proposes to use ssh on Wayland. Really strange...

This one is also interesting 🙈 - https://unix.stackexchange.com/a/771546

koppor avatar Jul 09 '24 10:07 koppor

I got it running:

image

sudo dnf install -y java-21-openjdk-devel.x86_64

koppor avatar Jul 09 '24 23:07 koppor

I also added X11 support for Fedora39 - just to be sure: sudo dnf install -y kwin-x11 plasma-workspace-x11

koppor avatar Jul 09 '24 23:07 koppor

declare -X DISPLAY=:0"

koppor avatar Jul 10 '24 06:07 koppor

sudo dnf install -y java-21-openjdk-devel.x86_64 did work.

ThiloteE avatar Jul 10 '24 10:07 ThiloteE

I would close the issue, once the apparent bug fix has been backported to the stable version of jdk 21, but I checked the jdk branches on github and there is no active jdk21 branch. Their latest tagged version has been stale for over a year, so what to do?

ThiloteE avatar Jul 10 '24 10:07 ThiloteE

@ThiloteE They use different repos for backports

Siedlerchr avatar Jul 10 '24 11:07 Siedlerchr

The thing is: I assumed that foojay would download the JDK automatically. But it does not for Fedora. WTF. --> Thus either "fix" foojay or fix our developer documentation!

koppor avatar Jul 10 '24 12:07 koppor

What's the status here`

Siedlerchr avatar Aug 25 '24 17:08 Siedlerchr

Reproduced using https://github.com/JabRef/jabref/tree/main/scripts/vms/fedora.

Workaround there: Explicit JDK installation.

Next step:

  • check if foojay should really download JDK
  • if not: think why it works on other OS
  • if yes: think why it does not on Fedora. Create a minimal java project and file upstream issue. Check if issue exists in upstream repository.

koppor avatar Aug 25 '24 20:08 koppor

With gradle 8.14 and JDK24, Windows also does not download:

Could not determine the dependencies of task ':jabgui:run'.
> Could not resolve all dependencies for configuration ':jabgui:runtimeClasspath'.
   > Failed to calculate the value of task ':jabgui:compileJava' property 'javaCompiler'.
      > Cannot find a Java installation on your machine (Windows 11 10.0 amd64) matching: {languageVersion=24, vendor=Azul Zulu, implementation=vendor-specific, nativeImageCapable=false}. No matching toolchain could be found in the configured toolchain download repositories.

But that was a Firewall issue - repored at https://github.com/gradle/foojay-toolchains/issues/107

koppor avatar Apr 29 '25 06:04 koppor

Next steps of https://github.com/JabRef/jabref/issues/11464#issuecomment-2308989040 still relevant

koppor avatar Apr 29 '25 07:04 koppor