Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when requiring java.awt.Color on headless openjdk install in GUI #6

Open
todbot opened this issue Nov 25, 2023 · 1 comment

Comments

@todbot
Copy link
Owner

todbot commented Nov 25, 2023

Trying to use blink1.setColor(Color) crashes because java.awt.Color does not exist if you've installed headless OpenJDK on Linux (e.g. sudo apt install openjdk-17-jdk-headless) and run in a GUI.

~/projects/blink1-java$ ./run-example.sh Example1
Looking for blink(1) devices...
blink(1) found: serial:3972f61f version:299
Fading to purple
Setting to green
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-17-openjdk-arm64/lib/libawt_xawt.so
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2398)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1953)
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
       [...]
	at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1397)
	at java.desktop/java.awt.Color.<clinit>(Color.java:277)
	at com.thingm.blink1.Example1.main(Example1.java:32)
@todbot todbot changed the title requires java.awt.Color, which is not available in headless openjdk installs Crashes when requiring java.awt.Color on headless openjdk install in GUI Nov 25, 2023
@todbot
Copy link
Owner Author

todbot commented Nov 25, 2023

The "solution" such that it is is to pass -Djava.awt.headless=true when invoking Java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant