FlexDoc JRE (OpenJDK+JavaFX) for macOS


Table Of Contents


What is FlexDoc JRE?

It is a Java Runtime Environment custom-built from OpenJDK and OpenJFX to run FlexDoc/XML+DiagramKit on macOS.

Although, FlexDoc/XML itself can be run on any standard Java SE, DiagramKit – FlexDoc/XML native diagramming engine – requires JavaFX, the newest Java graphics/GUI platform.

Before Java 11, JavaFX was a part of the standard Java SE. So, no problem existed with the JavaFX dependencies, and FlexDoc/XML+DiagramKit could be run immediately with any new Java version.

But since Java 11, Oracle has moved JavaFX into a separate project found on openjfx.io. Now, those who need JavaFX should download JavaFX SDK separately from there, install it and specify all JavaFX dependencies in their Java application according to that installation. That, of course, may be a bit complicated for ordinary users, and breaks down the whole idea of using some generic JRE preinstalled on user's computer (independently on FlexDoc/XML).

However, as a compensation for all that trouble (and actually as its goal), since Java 11, anyone can build their own custom JRE (called «runtime image») that may include in itself any other 3rd party modules necessary to run a given Java application on a particular computer platform. That's what we did.

How to install and use it?

Unfortunately, since the recent macOS version 11 (Big Sur), Apple has tightened the «security control» so much that in order to install and run any macOS executables, they must come either from Apple Store or «signed» with an Apple Developer Account, which is quite expensive to maintain. Since, we are not a true macOS developer and the number of potential FlexDoc/XML users, who work on macOS, is too small, we do not see it reasonable to overcome that hurdle directly. So, we cannot prepare an immediately ready FlexDoc JRE for macOS. Yet, we have found a way how to work that around and take care of macOS users as well.

We take advantage of that Apple still allows the macOS users to install and run on their computer the executables built by those users themselves. So, instead of preparing a ready to install & run FlexDoc JRE, we offer you an easy way to build it by yourself (which differs from the former mostly by the size of the downloaded archive file).

Here is the step-by-step instruction:

  1. Go to https://www.flexdoc.xyz/downloads/ and download from there:
    FlexDoc JRE (OpenJDK+JavaFX) to run FlexDoc/XML+DiagramKit | macOS/64 (zip)
    You should get this archive:
    flexdoc-jre-20_macOS.zip
  2. Unpack it into {flexdoc-xml} – your FlexDoc/XML installation directory. You will have a folder:
    {flexdoc-xml}/build_jre
    It does not contain a ready to use JRE. However, it contains all files necessary to build it, namely: Although, these archives do include the macOS executables, they are properly signed by their creators. So, macOS won't have security problems with them.
  3. Now, in order to build the real JRE, you only need to run the following script found in the same 'build_jre' directory:

    build_jre.command

    #!/bin/sh
    
    # Change current directory to the parent of this script file
    cd $(dirname $0)
    
    tar -xf openjdk-20.0.1_macos-x64_bin.tar.gz
    unzip openjfx-20.0.1_osx-x64_bin-jmods.zip
    
    export JAVA_HOME="jdk-20.0.1.jdk/Contents/Home"
    export PATH_TO_FX_MODS="javafx-jmods-20.0.1"
    
    $JAVA_HOME/bin/jlink --module-path $PATH_TO_FX_MODS \
        --add-modules java.base,java.desktop,java.xml,javafx.base,javafx.graphics,javafx.swing \
        --bind-services --output ../jre
    
    cp README.html ../jre
    
    Although, macOS won't allow you to run 'build_jre.command' straight, that is easy to overcome.
  4. First, open 'build_jre.command' with TextEdit (confirm in the warning box that it is OK to open it).

    Then, simply resave that file via File | Save menu.

    With that procedure, you will sign 'build_jre.command' as its owner/creator, which is a precondition to be able running it.

  5. On top of that, you will need also to assign 'build_jre.command' with the executable privilege.

    Run the Terminal and type in it 'chmod u+x' followed by a space and the full pathname of the script file (instead of typing it, just drag 'build_jre.command' from the Finder into the Terminal window). Then, press Enter.

    Now at last, you can run 'build_jre.command' from the Finder just by clicking twice on it.

  6. After running 'build_jre.command', a new directory will be created:
    {flexdoc-xml}/jre
    It will contain your Java to run FlexDoc/XML! (The 'build_jre' folder can be deleted then.)
  7. Now, you can run FlexDoc/XML using these scripts:

    But again, to be able running any of those script files, first you need to
    • Resave the script file using TextEdit.
    • Assign it with the executable privilege (by running the Terminal, typing in it 'chmod u+x' followed by a space, dragging script.command into the Terminal window and pressing Enter).

If you have any problems or questions, please let us know by sending an email to: support@flexdoc.xyz