Search code examples
javabuildantmirth

Mirth Connect: which java version to use to compile it from source?


I am trying to compile mirth connect from source https://github.com/nextgenhealthcare/connect from the 3.9.0 tag(, but also previous versions fail with he same errors)

On on hand I think it needs to be compiles with java9+ because it makes use of some javafx stuff which also the error indicates:

    [javac] Compiling 519 source files to /home/pwirth/code/connect/client/classes
    [javac] /home/pwirth/code/connect/client/src/com/mirth/connect/client/ui/Frame.java:54: error: cannot access Platform
    [javac] import javafx.application.Platform;
    [javac]                          ^
    [javac]   bad class file: /home/pwirth/code/connect/client/lib/openjfx.jar(javafx/application/Platform.class)
    [javac]     class file has wrong version 54.0, should be 52.0
    [javac]     Please remove or make sure it appears in the correct subdirectory of the classpath.

On the other hand it uses classes which are not accessible anymore since java 9 like this one:

    [javac]   (package com.sun.rowset is declared in module java.sql.rowset, which does not export it)
    [javac] /home/pwirth/code/connect/server/src/com/mirth/connect/server/userutil/MirthCachedRowSet.java:24: error: package com.sun.rowset is not visible
    [javac] import com.sun.rowset.CachedRowSetImpl;
    [javac]               ^
    [javac]   (package com.sun.rowset is declared in module java.sql.rowset, which does not export it)
    [javac] /home/pwirth/code/connect/server/src/com/mirth/connect/server/userutil/DatabaseConnection.java:128: error: incompatible types: MirthCachedRowSet cannot be converted to CachedRowSet
    [javac]             CachedRowSet crs = new MirthCachedRowSet();

I am executing ant -f mirth-build.xml and when running it when my JAVA_HOME is pointing to an java 11 also with the ant options to open the modules as described in their readme.md which declares --add-modules=java.sql.rowset


Solution

  • I compiled mirth 3.8 in the past with oracle java 8, which addresses your issues, but I had it installed from before Oracle made the licensing changes.

    Depending on your usage, you can still get it from Oracle for development purposes.

    That Mirth class probably should be fixed to not depend on com.sun.rowset.CachedRowSetImpl directly.