# FlexDoc JRE (OpenJDK+JavaFX) for Windows / x64

## Table Of Contents

- What is FlexDoc JRE?
- How it was built
- How to install and use it?

## What is FlexDoc JRE?

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

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 it was built

First, these two archives have beed downloaded:

- `openjdk-25.0.1_windows-x64_bin.zip` – from https://jdk.java.net/25/
- `openjfx-25.0.1_windows-x64_bin-jmods.zip` – from https://gluonhq.com/products/javafx/

then, placed in the same directory and the following BAT-script executed in it:

flexdoc-jre.bat

    tar -xf openjdk-25.0.1_windows-x64_bin.zip
    tar -xf openjfx-25.0.1_windows-x64_bin-jmods.zip

    @set JAVA_HOME="jdk-25.0.1"
    @set PATH_TO_FX_MODS="javafx-jmods-25.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_windows^
     --add-options="'--enable-native-access=javafx.graphics' '--sun-misc-unsafe-memory-access=allow'"

    7za a -tzip flexdoc-jre-25_windows jre_windows

`--add-options` is used here to specify the extra options to the JVM to suppress some annoying warings caused by some obsoletenesses in JavaFX implementation, which Java 25 reveals.

## How to install and use it?

1. Go to https://www.flexdoc.xyz/downloads/ and download from there:
     `FlexDoc JRE (OpenJDK+JavaFX) to run FlexDoc/XML+DiagramKit | Windows/x64 (zip)`
   You should get this archive:
     `flexdoc-jre-25_windows.zip`
2. Unpack it into `{flexdoc-xml}` – your FlexDoc/XML installation directory. You will have a folder:
     `{flexdoc-xml}\jre_windows`
   That will be your Java to run FlexDoc/XML!
3. Now, you can immediately run FlexDoc/XML using the following BAT-scripts.

   Template Processor (Generator) with DiagramKit activated as the diagramming engine:

   - `{flexdoc-xml}\XSDDoc\run_with_DiagramKit\windows\generator.bat`
   - `{flexdoc-xml}\WSDLDoc\run_with_DiagramKit\windows\generator.bat`

   Template Designer with DiagramKit:

   - `{flexdoc-xml}\XSDDoc\run_with_DiagramKit\windows\designer.bat`
   - `{flexdoc-xml}\WSDLDoc\run_with_DiagramKit\windows\designer.bat`

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