You are not logged in.
Pages: 1
The following command runs the Arduino IDE with a GTK look and feel (laf). I found it on the wiki
_JAVA_OPTIONS="-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djdk.gtk.version=3" arduino
This command works great on Java 8 through Java 11, but on Java 13, using this command, the Arduino IDE uses the cruddy default laf (metal maybe?). How do I set the look and feel in Java 13?
$ archlinux-java status
Available Java environments:
java-11-openjdk
java-13-openjdk (default)
java-8-openjdk
Any help is appreciated.
Offline
This is likely an arduino problem, not OpenJDK 13. This works fine for me on a simple Swing Java app compiled on JDK 13:
/usr/lib/jvm/java-13-openjdk/bin/java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djdk.gtk.version=3 -jar MyApp.jar
Check to see how arduino is launched - there's likely a .sh script that builds the classpath, etc. and then launches the JVM. It's possible that it's ignoring _JAVA_OPTIONS. To prove it, hack the launch script and force these options in there to see if that launches with the GTK laf.
Offline
Your suspicion was correct!
Here is the relevant part of the Arduino launcher script (/usr/share/arduino/arduino)
# Collect options to java in an array, to properly handle whitespace in options
JAVA_OPTIONS=("-DAPP_DIR=$APPDIR")
# Only show the splash screen when no options are present
if [[ "$@" != *"--"* ]] ; then
JAVA_OPTIONS+=("-splash:$APPDIR/lib/splash.png")
fi
"$JAVA" "${JAVA_OPTIONS[@]}" processing.app.Base "$@"
changing JAVA_OPTIONS=("-DAPP_DIR=$APPDIR") to JAVA_OPTIONS=("-DAPP_DIR=$APPDIR" "-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel" "-Djdk.gtk.version=3") fixed the problem. I'll look further into this, hopefully finding a more satisfactory workaround and may submit a bug report either to the Arch Linux Arduino package or to Arduino upstream.
The arduino.desktop file contains Exec=arduino %U so it appears not to use a script on startup. I looked through all the files installed with the arduino package (using pacman -Qlq arduino). I found an install script, so I tried uninstalling and reinstalling arduino, but this still did not fix the problem. Could you post the code (or .jar) for that simple swing app to help me narrow down the problem?
Last edited by maxbla (2020-01-24 10:02:27)
Offline
I added
swing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
to my _JAVA_OPTIONS environment variable as suggested on the wiki and it worked without modifying the arduino startup script.
The full line in my /etc/environment is
_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djdk.gtk.version=3'
Offline
Pages: 1