Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Running COMSOL with Java externally

Please login with a confirmed email address before reporting spam

I know the COMSOL API reference guide discusses this, but the instructions are unclear for someone like me with no background in Java/Eclipse. I know you can export COMSOL models as Java files.

How do you run (if you can) run COMSOL 4.1 externally with Eclipse/Java? I have tried following doing the feeder_clamp instructions with importing all the plug ins but it does not work. any help would be appreciated even the most simple example.

7 Replies Last Post 16.08.2016, 02:41 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 03.08.2011, 04:51 GMT-4
Hello,

I use the java code de COMSOL 4.2 in Eclipse/Java,

Only, I import two packages

import com.comsol.model.*;
import com.comsol.model.util.*;

And, I add the *.jars (C:\Program Files\COMSOL42\plugins) in the library buiding-project of Eclipse,

Aron
Hello, I use the java code de COMSOL 4.2 in Eclipse/Java, Only, I import two packages import com.comsol.model.*; import com.comsol.model.util.*; And, I add the *.jars (C:\Program Files\COMSOL42\plugins) in the library buiding-project of Eclipse, Aron

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 03.08.2011, 12:18 GMT-4
Hi Alex,

I have installed Comsol 4.2, generated the Java source file for the feeder_clamp model, and created the Eclipse project as described in the documentation.

When I open the compiled .class file (it can be found in the bin directory of the project) from the Comsol Desktop, the model is loaded and a graphic of a mechanical part is generated. I don't know if you have tried this, but it's an easy way of running the Java model.

However, if I follow the instructions to execute the Java model from Eclipse, and using the Comsol server, when I run the Java application a message is displayed in the server window indicating that a client is connecting, and after a while another message indicates that the client is disconnecting, but nothing more happens... I have followed all the instructions given in the documentation to configure the Eclipse project, i.e. adding the libraries to the project, and adding the two lines in the main method for connecting to the Comsol server, but it doesn't say the expected behaviour when you proceed so...

Do you have any more idea?

Best regards.

P.D.: I'm the Ana's colleague at the CSIC in Spain.


Hi Alex, I have installed Comsol 4.2, generated the Java source file for the feeder_clamp model, and created the Eclipse project as described in the documentation. When I open the compiled .class file (it can be found in the bin directory of the project) from the Comsol Desktop, the model is loaded and a graphic of a mechanical part is generated. I don't know if you have tried this, but it's an easy way of running the Java model. However, if I follow the instructions to execute the Java model from Eclipse, and using the Comsol server, when I run the Java application a message is displayed in the server window indicating that a client is connecting, and after a while another message indicates that the client is disconnecting, but nothing more happens... I have followed all the instructions given in the documentation to configure the Eclipse project, i.e. adding the libraries to the project, and adding the two lines in the main method for connecting to the Comsol server, but it doesn't say the expected behaviour when you proceed so... Do you have any more idea? Best regards. P.D.: I'm the Ana's colleague at the CSIC in Spain.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 23.11.2015, 10:43 GMT-5
Hello Nacho,

this is normal behaviour. You do not see anything if you run your java file in Eclipse. If you want to see something you have to use the Graphical User Interface which is described in "COMSOL Multiphyiscs/COMSOL Multiphisics Programming Reference Manual/Graphical User Interfaces" in the documentation.
I know that this post is old but I'm answering for descendants.

Best regards
Michael
Hello Nacho, this is normal behaviour. You do not see anything if you run your java file in Eclipse. If you want to see something you have to use the Graphical User Interface which is described in "COMSOL Multiphyiscs/COMSOL Multiphisics Programming Reference Manual/Graphical User Interfaces" in the documentation. I know that this post is old but I'm answering for descendants. Best regards Michael

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 02.06.2016, 02:49 GMT-4
Hi Michael:
Can you tell me where to find the COMSOL API user guide? I would great appreciate if you could help me.
Best regards
rene
Hi Michael: Can you tell me where to find the COMSOL API user guide? I would great appreciate if you could help me. Best regards rene

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 02.06.2016, 08:52 GMT-4
All manuals for your installation are accessed in the GUI through File > Help > Documentation, and in the doc subdirectory in your installation directory (Usually C:/Program Files/COMSOL/COMSOL52/Multiphysics/doc/ on Windows)
Jeff
All manuals for your installation are accessed in the GUI through File > Help > Documentation, and in the doc subdirectory in your installation directory (Usually C:/Program Files/COMSOL/COMSOL52/Multiphysics/doc/ on Windows) Jeff

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 15.08.2016, 11:17 GMT-4
Hi Jeff,
I'm trying to add the java file generated by COMSOL to my NetBeans project. It calls for these two imports:
import com.comsol.model.Model;
import com.comsol.model.util.*;

It is not clear, however, which jar files need to be added to my project to provide the information required. Can you point me to the correct jar files?
Thanks,
Herb Smith
Hi Jeff, I'm trying to add the java file generated by COMSOL to my NetBeans project. It calls for these two imports: import com.comsol.model.Model; import com.comsol.model.util.*; It is not clear, however, which jar files need to be added to my project to provide the information required. Can you point me to the correct jar files? Thanks, Herb Smith

Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 16.08.2016, 02:41 GMT-4
Hi

In the Programming Reference Manual in the chapter "Graphical User Interfaces" it says:
"Go to the Libraries tab and click Add External JARs. Add all the JAR files placed in the plugins directory under the COMSOL Multiphysics installation directory (typically
C:\Program Files\COMSOL\COMSOL52a\Multiphysics\plugins)."

I'm sure that there is a similar procedure for NetBeans.

--
Lars Gregersen
Comsol Denmark
Hi In the Programming Reference Manual in the chapter "Graphical User Interfaces" it says: "Go to the Libraries tab and click Add External JARs. Add all the JAR files placed in the plugins directory under the COMSOL Multiphysics installation directory (typically C:\Program Files\COMSOL\COMSOL52a\Multiphysics\plugins)." I'm sure that there is a similar procedure for NetBeans. -- Lars Gregersen Comsol Denmark

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.