Starting with Mirth Connect 4.0, the JavaScript engine is GraalVM, not Nashorn or Rhino anymore. This changes how you access Java classes slightly.
2. Updated Syntax with GraalVM
In GraalVM, Java.type() still works for now, but may have some restrictions depending on the Java version and security context. You may need to use Packages. in some cases or adjust security settings.
Step-by-Step for Mirth 4.5.2
1. Place Your JAR File in the Right Location
Recommended: MIRTH_HOME/custom-lib/ (e.g., /opt/mirth-connect/custom-lib/ or C:\Program Files\Mirth Connect\custom-lib\)
Restart the Mirth Connect service (not just the Administrator UI).
For the below code to work you need to place dcm4che-core-5.34.0.jar from the Releases Β· dcm4che/dcm4che Β· GitHub release into the custom-lib folder
2. Access the Java Class in a JavaScript Transformer/Step
var UIDUtils = Packages.org.dcm4che3.util.UIDUtils;
var uid = UIDUtils.createUID();
logger.info("Generated UID: " + uid);