Please see the attached doc for well formatted version with screenshots.
Perhaps it’s not a goal or priority to support such level of interoperability with Java as in my case, but I want to report it.
Comsol multiphysics
<image>
has a convenient feature of exporting your model to Java source code
<image>
This generates a single java file that contains a sequence of calls against the Comsol API. All the calls just reproduce what the user did in GUI while building his model. After compiling the source with Java 1.6, you get a *.class file that you can load back into Comsol. Comsol “replays” all commands and builds the model.
<image>
I hoped to use Kotlin instead of Java to algorithmically generate complex periodic geometrical structures in my model.
Java file that Comsol generates, has standard public static void main() method that directly or indirectly calls COMSOL API. I was able to use Kotlin package-level functions to call COMSOL API , and to call Kotlin package level functions from Java’s main. This way Comsol loaded model successfully. Whenever the call hierarchy starting at public static void main() contains instantiation of any Kotlin class , COMSOL fails to load the generated class-file
<image>
The error message is everything that COMSOL shows, no more logs or information AFAIK.
I can run generated files from command line, but they fail to load in COMSOL.
[A possible case of binary incompatibility with Java.docx|attachment](upload://js4nq94OMZSzoeQxyrdJhm6n281.docx) (164 KB)