Unable to Launch FreeMind

Recently I installed FreeMind (from the AUR) on Manjaro but when I tried to run it, nothing happened. After trying to launch it from a terminal, I get some information back.

[andy@home-pc ~]$ freemind 
Checking Java Version...
Exception in thread "main" java.lang.reflect.InaccessibleObjectException: Unable to make field private static java.lang.String sun.awt.X11.XToolkit.awtAppClassName accessible: module java.desktop does not "opens sun.awt.X11" to unnamed module @5a8e6209
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
	at freemind.main.FreeMindStarter.main(FreeMindStarter.java:72)

A google search seems to indicate this is a bug and a work-around can be found with the --add-opens option. The exact change I made was in /usr/bin/freemind.

$ sudo vim /usr/bin/freemind

Always a good idea to take a backup first!

$ sudo cp -v /usr/bin/freemind ~/freemind.bkup

Edit the file using vim, vi, nano, etc.

$ sudo vim /usr/bin/freemind

And add --add-opens="java.desktop/sun.awt.X11=ALL-UNNAMED" as shown in the below diff output.

$ diff ~/freemind.bkup /usr/bin/freemind
< 	"${JAVACMD}" -Xmx256M -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@"
> 	"${JAVACMD}" --add-opens="java.desktop/sun.awt.X11=ALL-UNNAMED" -Xmx256M -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@"
< 	"${JAVACMD}" -Xmx256M -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@"
> 	"${JAVACMD}" --add-opens="java.desktop/sun.awt.X11=ALL-UNNAMED" -Xmx256M -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@"

This resolved the issue I was having. However, perhaps a better way of installing this particular package would have been to use snaps, as shown here.

Be the first to comment

Leave a Reply