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.

Can't run Model File for Java in Eclipse

Please login with a confirmed email address before reporting spam

Hi,

I just started working with COMSOL so I don't know much, but I am trying to automate a process in COMSOL by exporting the COMSOL file into Eclipse as a Model file and running it in Eclipse. The idea is to set up many electrodes and one-by-one test each electrode while disabling all others. All that I'm trying to produce are numerical results exported into a text file, so the GUI is not so important.

The problem is when I run the code I get this error:

java.lang.UnsatisfiedLinkError: com.comsol.nativejni.server.FlRunnable.createRunInfo(Lcom/comsol/nativejni/CPointer;)V
at com.comsol.nativejni.server.FlRunnable.createRunInfo(Native Method)
at com.comsol.nativejni.server.FlRunnable.<init>(Unknown Source)
at com.comsol.nativeutil.runnable.f.<init>(Unknown Source)
at com.comsol.model.method.GeomSequenceMethod$1.<init>(Unknown Source)
at com.comsol.model.method.GeomSequenceMethod.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.comsol.model.internal.impl.PrimitiveModelEntityImpl.a(Unknown Source)
at com.comsol.model.internal.impl.PrimitiveModelEntityImpl.bl(Unknown Source)
at com.comsol.model.internal.impl.GeomSequenceImpl.method(Unknown Source)
at com.comsol.model.internal.impl.GeomSequenceImpl.method(Unknown Source)
at com.comsol.model.internal.impl.ModelEntityImpl.h_(Unknown Source)
at com.comsol.model.internal.impl.ModelEntityImpl.tag(Unknown Source)
at com.comsol.model.internal.impl.GeomListImpl.doCreate(Unknown Source)
at com.comsol.model.internal.impl.GeomListImpl.a(Unknown Source)
at com.comsol.model.internal.impl.GeomListImpl$1.a(Unknown Source)
at com.comsol.model.internal.impl.GeomListImpl$1.execute(Unknown Source)
at com.comsol.model.clientserver.ClientManager$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Failed to find methods for: com.comsol.model.internal.impl.GeomSequenceImpl
---------------------------------------
I did some research already and I have already configured the build path in Eclipse to include all of the .jar files in the /plugins directory of COMSOL, so that doesn't seem to be the problem.

The error is actually coming from the beginning of my code in the run() method:

public static Model run() {
Model model = ModelUtil.create("Model");
model.modelPath("C:\\Users\\Marcel\\workspace\\New folder");
model.comments("Untitled\n\n");

model.modelNode().create("comp1");
model.geom().create("geom1", 3); <----the error is here
model.mesh().create("mesh1", "geom1");

I am positive that the error is occurring when creating the geometry because commenting that line gets rid of the error message but causes the program run for an indefinite amount of time.

Can anybody help me solve this problem?

Thanks,
Aaron

3 Replies Last Post May 29, 2017, 1:51 p.m. EDT
COMSOL Moderator

Hello Aaron Yu

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.


Please login with a confirmed email address before reporting spam

Posted: 7 years ago Apr 24, 2017, 5:52 a.m. EDT
I am experiencing the same problem. Did you manage to find a solution this problem?
I am experiencing the same problem. Did you manage to find a solution this problem?

Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Apr 25, 2017, 7:32 a.m. EDT
Hi

This section is from the Programming Reference Manual:

"Select the Environment tab. Click the New button. Use the Name PATH (on Windows), LD_LIBRARY_PATH (on
Linux), or DYLD_LIBRARY_PATH (on Mac) and enter the following text in Value: <comsolinstalldir>/lib/
<platformname> where <comsolinstalladir> is the directory where COMSOL Multiphysics is installed and
<platformname> is one of win64/glnxa64/maci64 depending on your platform. Click Apply."

See if that helps.


--
Lars Gregersen
Comsol Denmark
Hi This section is from the Programming Reference Manual: "Select the Environment tab. Click the New button. Use the Name PATH (on Windows), LD_LIBRARY_PATH (on Linux), or DYLD_LIBRARY_PATH (on Mac) and enter the following text in Value: /lib/ where is the directory where COMSOL Multiphysics is installed and is one of win64/glnxa64/maci64 depending on your platform. Click Apply." See if that helps. -- Lars Gregersen Comsol Denmark

Please login with a confirmed email address before reporting spam

Posted: 7 years ago May 29, 2017, 1:51 p.m. EDT
Hey.

But I couldn't find the environment tab in Eclipse 4.6.3.
I am pretty new to JAVA, Eclipse and COMSOL too, as such.

Any help would be greatly appreciated.

Thanks.
Amruth
Hey. But I couldn't find the environment tab in Eclipse 4.6.3. I am pretty new to JAVA, Eclipse and COMSOL too, as such. Any help would be greatly appreciated. Thanks. Amruth

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.