You are not logged in.

#1 2020-01-19 08:16:43

maxbla
Member
Registered: 2020-01-19
Posts: 2

Java Look and Feel with OpenJDK 13

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

#2 2020-01-23 22:11:38

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 539

Re: Java Look and Feel with OpenJDK 13

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

#3 2020-01-24 08:08:41

maxbla
Member
Registered: 2020-01-19
Posts: 2

Re: Java Look and Feel with OpenJDK 13

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

Board footer

Powered by FluxBB