Failed to initialize JavaFX

Support for Ubuntu and other Desktop Linux distributions
Post Reply
PriamX
Posts: 7
Joined: 12 Jan 2021, 01:25

Failed to initialize JavaFX

Post by PriamX »

I have installed FileBot on Fedora 33 running Java 11 as per [TAR] How to install FileBot on Linux / FreeBSD / Solaris / any Unix OS viewtopic.php?f=11&t=6057

Here are the details:

Code: Select all

[admin@mediaserv ~]$ filebot -script fn:sysinfo
FileBot 4.9.2 (r8046)
JNA Native: 6.1.0
MediaInfo: 20.08
7-Zip-JBinding: 16.02
Tools: NONE
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2020-12-01 (r724)
Groovy: 3.0.6
JRE: OpenJDK Runtime Environment 11.0.9.1
JVM: 64-bit OpenJDK 64-Bit Server VM
CPU/MEM: 8 Core / 16 GB Max Memory / 52 MB Used Memory
OS: Linux (amd64)
HW: Linux mediaserv 5.9.16-200.fc33.x86_64 #1 SMP Mon Dec 21 14:08:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
CPU/MEM: Intel(R) Xeon(R) E-2134 CPU @ 3.50GHz [MemTotal: 67 GB | MemFree: 534 MB | MemAvailable: 55 GB | SwapCached: 566 MB | SwapTotal: 107 GB | SwapFree: 104 GB]
STORAGE: xfs [/] @ 909 GB | xfs [/media] @ 50 TB | xfs [/home] @ 811 GB
DATA: /opt/filebot/data/1000
Package: TAR
Activate License [P17846500] on [Mon Jan 11 18:36:36 MST 2021]
License: FileBot License P17846500 (Valid-Until: 2021-09-24)
Done ヾ(@⌒ー⌒@)ノ
My system is headless so I first use PuTTY to SSH into it and use an X server (vcXsrv) to display the FileBot GUI.

I have installed javafx-sdk-11.0.2 from openjfx,io

When I click on "Load" (either Select Folder or Select Files), I receive the following error:

Code: Select all

Failed to initialize JavaFX: javafx/embed/swing/JFXPanel
java\.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
        at net.filebot.util.ui.SwingUI.useJavaFX(Unknown Source)
        at net.filebot.UserFiles$FileChooser$5.showLoadDialogSelectFiles(Unknown Source)
        at net.filebot.UserFiles.selectSelectFiles(Unknown Source)
        at net.filebot.UserFiles.lambda$showLoadDialogSelectFiles$0(Unknown Source)
        at net.filebot.UserFiles.lambda$withModeSelect$1(Unknown Source)
        at net.filebot.util.ui.SwingUI.withWaitCursor(Unknown Source)
        at net.filebot.UserFiles.lambda$withModeSelect$2(Unknown Source)
        at net.filebot.util.ui.SwingUI.lambda$invokeLater$9(Unknown Source)
        at net.filebot.UserFiles.withModeSelect(Unknown Source)
        at net.filebot.UserFiles.showLoadDialogSelectFiles(Unknown Source)
        at net.filebot.ui.transfer.LoadAction.actionPerformed(Unknown Source)
        Caused by: java\.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel
        at java\.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java\.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        ... 11 more
However, under 'Select Folder' the only buttons that work are the 'Open' and 'Cancel' buttons; I am otherwise unable to use it.

Under 'Select Files' everything appears to work and this has been my workaround to the above problem.

But I would like 'Select Folder' to work. Any ideas?

Thanks!

-Mike
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Failed to initialize JavaFX

Post by rednoah »

You have multiple options.


A.
Install a JDK that includes the JavaFX modules:
https://bell-sw.com/pages/liberica-rele ... es-15.0.1/


B.
Install OpenJRE and OpenJFX and set --module-path via JAVA_OPTS accordingly so that java can find the modules, wherever they may be on your machine.


C.
If you're using Fedora Core, then the Fedora repository might work better for you:
https://www.filebot.net/linux/yum.html


D.
Configure FileBot to not use the GTK native FileDialog:

Code: Select all

filebot -script fn:properties --def net.filebot.UserFiles.fileChooser=Swing
:idea: viewtopic.php?t=3913


E.
Ignore the problem and use Drag-and-Drop instead.
:idea: Please read the FAQ and How to Request Help.
PriamX
Posts: 7
Joined: 12 Jan 2021, 01:25

Re: Failed to initialize JavaFX

Post by PriamX »

This is fantastic help. Thank you very much!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Failed to initialize JavaFX

Post by rednoah »

Let us know what worked best for you. ;)
:idea: Please read the FAQ and How to Request Help.
PriamX
Posts: 7
Joined: 12 Jan 2021, 01:25

Re: Failed to initialize JavaFX

Post by PriamX »

Well, I didn't go with option E ;)

Option D worked well, but I was less enthused about the Swing-type interface.

I attempted option B because JRE and FX were already installed, but I couldn't get it to work, I'm not sure if it wasn't finding the module or what was going on there; I didn't monkey with it too long.

I finally landed on option A which just worked without issue and gave me the nicer JavaFX file selection interface.

Thanks again for your help.
PriamX
Posts: 7
Joined: 12 Jan 2021, 01:25

Re: Failed to initialize JavaFX

Post by PriamX »

Just follow-up a couple years later, for those that may come here.

I'm still using FileBot quite successfully on Fedora (now on release 37).

My opinion has changed since solving it with Option A originally, my current opinion is that rednoah's Option C (using the Fedora repository), is far easier to manage; java is hassle-free and Fedora's dnf takes care of the updates and upgrades for you.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Failed to initialize JavaFX

Post by rednoah »

Notably, JavaFX is no longer required, since newer version of FileBot use the zenity command-line tool by default if available.


You can force this implementation like so:

Code: Select all

filebot -script fn:properties --def net.filebot.UserFiles.fileChooser=Zenity
:idea: Please read the FAQ and How to Request Help.
Post Reply