Compiling a Model File for Java®
First make sure that COMSOL Multiphysics is installed. See the COMSOL Multiphysics Installation Guide for more information if required.
To test compiling a model files for Java, load feeder_clamp.mph from the COMSOL Multiphysics Application Library into the COMSOL Desktop.
You can learn most of the syntax for creating a model using the COMSOL API by first creating a model using the COMSOL Desktop and then saving the model as an application file for Java.
To open the Application Libraries window ():
In the Home toolbar, click Windows and select Application Libraries. When the toolbar is compressed, you sometimes find it under Layout > Windows.
You can also customize the Quick Access Toolbar and then click the Application Libraries () button in the toolbar.
From the File menu select Application Libraries.
To open the Application Libraries window ():
From the File or Windows menu select Application Libraries.
In the Application Libraries tree, expand COMSOL Multiphysics and then Structural Mechanics. Select the feeder_clamp model, then click the Open button to open it. To get a Java file to compile, choose Save As from the File menu and choose Model file for Java (*.java) as the file type. It is suggested that you save the file as feeder_clamp.java in your home directory.
To compile feeder_clamp.java, enter
<COMSOL path>\bin\win64\comsolcompile feeder_clamp.java
on Windows and
<COMSOL path>/bin/comsol compile feeder_clamp.java
on Linux and macOS, where <COMSOL path> is the COMSOL installation directory.