Set Java Path in Flatseal?

EDIT2: I’ve figure this out. It wasn’t a Flatseal issue. See the bottom of this post for more details if you’re interested.

OP: I’m pretty sure I need to be able to set the path to java in Flatseal.

More information: I’m using the flatpak version of Calibre from Bazaar. I have the EpubCheck plugin installed within Calibre. It requires java. So, I installed java with:

brew install openjdk

But, when I try to run EpubCheck while editing an epub in Calibre, it can’t find java. I’m assuming I need to set the JAVA_HOME environment variable in Flatseal to fix that.

The java information I get in Terminal:

dave@bazzite:~$ java --version
openjdk 25.0.1 2025-10-21
OpenJDK Runtime Environment Homebrew (build 25.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 25.0.1, mixed mode, sharing)
dave@bazzite:~$ brew --prefix java
/home/linuxbrew/.linuxbrew/opt/openjdk

I thought I needed to add that last path to Calibre’s Environment Variables section in Flatseal as:

JAVA_HOME='/home/linuxbrew/.linuxbrew/opt/openjdk'

But, it still doesn’t see java (I’ve tried with and without various quote marks).

I’ve also added JAVA_HOME and modified the path in .bash_profile:

export JAVA_HOME='/home/linuxbrew/.linuxbrew/opt/openjdk'
export PATH=$PATH:$JAVA_HOME/bin

And, it still doesn’t work.

Any suggestions on how to get this working.

EDIT: I’ll add the actual error in Calibre about it not finding java (just in case):

calibre, version 8.16.2
ERROR: Unhandled exception: <b>FileNotFoundError</b>:[Errno 2] No such file or directory: 'java'

calibre 8.16.2  embedded-python: True
Linux-6.17.7-ba20.fc43.x86_64-x86_64-with-glibc2.42 Linux ('64bit', 'ELF')
('Linux', '6.17.7-ba20.fc43.x86_64', '#1 SMP PREEMPT_DYNAMIC Mon Dec  8 23:40:18 UTC 2025')
Python 3.11.14
Interface language: None
EXE path: /app/lib/calibre/bin/calibre-parallel
Successfully initialized third party plugins: DeACSM (0, 0, 16) && DeDRM (10, 0, 3) && Diaps Editing Toolbag (0, 5, 0) && EpubCheck (0, 2, 6) && Goodreads (1, 8, 3) && Kobo Utilities (2, 24, 5) && Modify ePub (1, 8, 8) && Quality Check (1, 14, 6) && ScrambleEbook (0, 6, 0)
Traceback (most recent call last):
  File "calibre_plugins.epub_check.main", line 274, in ask_user
    is32bit = prefs.get('is32bit', get_arch(java_path) == '32')
                                   ^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.epub_check.main", line 126, in get_arch
    ret, retcode = jarWrapper(*args)
                   ^^^^^^^^^^^^^^^^^
  File "calibre_plugins.epub_check.main", line 116, in jarWrapper
    process = subprocess.Popen(list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=startupinfo)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "subprocess.py", line 1026, in __init__
  File "subprocess.py", line 1955, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'java'

EDIT2 (continued from top): in my particular case, the problem was in the configuration file for the EpubCheck plugin. That’s EpubCheck.json at:

/var/home/dave/.var/app/com.calibre_ebook.calibre/config/calibre/plugins/

I got to that in Calibre by going to Preferences > Advanced > Miscellaneous > Open Calibre Configuration Folder.

In that, there was a line:

"java_path": "java"

I just had to specify the full path:

"java_path": "/home/linuxbrew/.linuxbrew/bin/java"

I got that path via the Terminal command:

which java

Once I changed that java_path in the JSON file, saved everything, and restarted stuff, everything worked.

Hope that helps others.