Loading mph file from CUI using Java

Please login with a confirmed email address before reporting spam

I want to load an .mph file from the command line using Java. I compiled TestModelLoad.java (attached) and ran it, but the program stalls at the line "ModelUtil.load(tag, path);" without any error. I have confirmed that the .mph file can be opened successfully in the COMSOL GUI. Could you provide any information or suggestions to help me resolve this issue?

The following is my set up information:
OS: Windows11
Editor: VSCode
Command line: Git Bash
COMSOL version: COMSOL63
javac and java version:
javac 25.0.2
openjdk 25.0.2 2026-01-20 LTS
OpenJDK Runtime Environment Temurin-25.0.2+10 (build 25.0.2+10-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.2+10 (build 25.0.2+10-LTS, mixed mode, sharing)

The followings are commands I executed and command line outputs:
$ javac -cp "$COMSOL_HOME/plugins/*" TestModelLoad.java
$ java -Djava.library.path="$COMSOL_HOME/bin/win64" -cp "$COMSOL_HOME/plugins/*;." TestModelLoad
(COMSOL_HOME="C:/Program Files/COMSOL/COMSOL63/Multiphysics/" )

PID=27104
Init COMSOL...
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by com.comsol.model.util.ServerModelUtil$15 in an unnamed module (file:/C:/Program%20Files/COMSOL/COMSOL63/Multiphysics/plugins/com.comsol.model_1.0.0.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled
Loading: D:\works\test\test_capacitor.mph



Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.