raspberrypi / bookworm-feedback

13 stars 1 forks source link

Java / Eclipse graphics broken on Raspberry Pi OS 5.1 (Deebian 12, bookworm) on Raspberry Pi 4B #199

Closed nyholku closed 9 months ago

nyholku commented 10 months ago

I have a Java application where the basic Swing JButtons look strange, see below, this application works perfectly on bullseye.

IMG_9572 2

To investigate this I tried to load the latest Eclipse to my bookworm installation but launching the installer the window just shows vertical line segments, see below:

IMG_9576 2

To double check I made a clean install of latest Raspberry Pi OS (5.1) and re-downloaded latest Eclipse for AArch64 and it this is an easy way to replicate this problem.

My gut feeling is that this is a Raspberry Pi OS issue, specifically to do with the graphics drivers but I'm ready to report this to OpenJDK ro Eclipse communities if that seems advisable.

nyholku commented 10 months ago

I just spend better part of morning installing Raspberry Pi OS versions and Eclipse.

As can be seen from below (those with links in violet/purple) I've tried eight of the thirteen 64bit version of Raspberry Pi OS.

Only the last one,

https://downloads.raspberrypi.com/raspios_arm64/images/raspios_arm64-2023-12-06/

fails.

Screenshot 2024-01-28 at 11 52 34
XECDesign commented 10 months ago

Is there a quicker/simpler way to reproduce it than installing eclipse? A minimal testcase with instructions would be helpful.

nyholku commented 10 months ago

At the moment I do not know of any more ways than those tow that I showed above.

If you install/run my app:

EazyCNC-2.0.38 for Raspberry Pi (aarch64/Raspberry Pi OS)

this should show the problem pictured in the first pic above.

The second image is from running Eclipse installer, so you do not actually have to install Eclipse, just try to install it.

Both methods require downloading some code (mine is smaller) and running the code.

My hunch is that a simple a JFrame and JButton could reproduce the problem, what I have in my app istandard Swing buttons there.

Some one suggested that this related to Wayland so I'm going to try X11.

As this is very tedious downloading, installing and testing on single SD card I am going to get some more SD cars so I can speed experimenting up.

XECDesign commented 10 months ago

To save you time, I'm seeing it under X11 as well. I suspect the mesa update to be the most likely culprit.

nyholku commented 10 months ago

Thank you, that was very nice of you. It does save time, I spent better part of yesterday experimenting and it gets old very fast. :)

XECDesign commented 10 months ago

Doesn't seem to be mesa either. Issue happens with the older version as well. I'll keep digging.

XECDesign commented 10 months ago

Only the last one,

https://downloads.raspberrypi.com/raspios_arm64/images/raspios_arm64-2023-12-06/

fails.

Hm? I just tried a clean 2023-10-10 image and it also fails.

nyholku commented 10 months ago

I can retest this as I get home from office, maybe I got my notes/versions mixed up, I did so many tests Yesterday and the long times that it takes to burn each image to an SD card does make it hard to concentrate on the task at hand.

nyholku commented 10 months ago

Hi, I just retested this and my app fails on 2023-10-10 so I must have made a mistake when I reported that it works for me.

Interesting, I also discussed this first here:

https://forums.raspberrypi.com/viewtopic.php?p=2187047#p2187047

and someone reported that Eclipse works for him/he with X11 on Pi5

XECDesign commented 9 months ago

Having previously spent time looking at the many issues openjdk has, it always ends up being a rabbit hole I regret going down.

Closing for now, but if someone says "it worked in this bookworm image, but not this one" then I can take a look again and figure out who to forward it to. For now, I'll chalk it up to java being java.

nesslinger-it commented 9 months ago

I know the thread is closed but I also have trouble with this with own programmed applications with Java and Netbeans which use Swing Controls. The problem occurs already since summer 2023 and affects also Raspberry 4. I tested it with native Raspian and with Ubuntu 22 on Pi4 and Ubuntu 23 on the Pi 5.

The same applications works without trouble in a virtual Machine with Ubuntu 22.04 on a Windows host.

Maybe interesting for the error research for you. If you start the (Java) Application with -Dsun.java2d.opengl=true than the image fragements are gone. But other will apear (partly black window, and only Buttons visible on the mouse position). But sometimes the window is also completly correct rendered. To reproduce with Java-Applications: java -Dsun.java2d.opengl=true -jar "path to your jar file"

arsi-apli commented 6 months ago

The problem is with Nimbus LaF: obrázok With Metal LaF everything works without problems: obrázok

nesslinger-it commented 6 months ago

The problem is with Nimbus LaF: obrázok With Metal LaF everything works without problems: obrázok

Thanks for the hint. But it seems that the application needs the correct librarys to do this change. If i run for example java -Dswing.defaultlaf=javax.swing.plaf.metal.metallookandfeel MyApp than i get some errors that the metal look and feel could not be loaded. So maybe this solution does not work with all Java Applications.

If i add this simple line in my code UIManager.setLookAndFeel(new MetalLookAndFeel()); before the initComponents() than all looks very well! Tested it with Raspi 400 and the latest Ubuntu 22.04 LTS today.

Thank you very much!