Page 1 of 2

Getting Matlab OpenSim interface to work

Posted: Wed Apr 16, 2014 12:21 pm
by sjwohlman
I followed the instructions from: http://simtk-confluence.stanford.edu:80 ... anualSetup

but when I run one of the example scripts, I get a Java error.

Java exception occurred:
java.lang.NoClassDefFoundError: Could not initialize class org.opensim.modeling.opensimModelJNI

at org.opensim.modeling.Model.<init>(Model.java:127)

Any suggestions on how to fix this?

Thanks!

Re: Getting Matlab OpenSim interface to work

Posted: Wed Apr 16, 2014 12:33 pm
by jimmy
Hi Sarah,

Did you use the automated matlab setup script (configureOpenSim.m)?

Does an error occur when you run any openSim API code or just the one example script?

Re: Getting Matlab OpenSim interface to work

Posted: Wed Apr 16, 2014 2:27 pm
by sjwohlman
I was previously using 3.1 so that is why I didn't use the automated setup script. But when I tried the automated setup script with 3.2, it worked.

I'm able to run most of the example scripts except for TugOfWar_CompleteRunVisualize.m, I'm still getting an error with the visualizer.

Re: Getting Matlab OpenSim interface to work

Posted: Mon Feb 13, 2017 1:31 pm
by vrutang
Hello,
I am also getting the same error. I have used the automated script and I also got the pop up message that it configured successfully. Now, when I tried to run any of the examples scripts, it showing me following error:
Error using TugOfWar_CompleteRunVisualize (line 32)
Java exception occurred:
java.lang.NoClassDefFoundError: Could not initialize class org.opensim.modeling.opensimModelJNI

at org.opensim.modeling.Model.<init>(Model.java:127)


I have also attached snap shot of the matlab command window for reference.
Any help is highly appreciated!

Thanks.

Re: Getting Matlab OpenSim interface to work

Posted: Mon Feb 13, 2017 1:58 pm
by jimmy
Hi-

You may have to run Matlab as administrator. A previous thread had a similar issue

-j

Re: Getting Matlab OpenSim interface to work

Posted: Mon Feb 13, 2017 4:11 pm
by vrutang
I have tried with running Matlab as administrator. Now it is showing me this error as attached.

Then I looked up in the troubleshooting given in http://simtk-confluence.stanford.edu:80 ... ith+Matlab. But still I am getting this error.

Would you please help me out in resolving this issue?

Thanks!

Re: Getting Matlab OpenSim interface to work

Posted: Mon Feb 13, 2017 4:43 pm
by tkuchida
This error message appears to be addressed in the first bullet of the Troubleshooting section on the "Scripting with Matlab" page (http://simtk-confluence.stanford.edu:80 ... ith+Matlab). Have you added the OPENSIM_INSTALL_DIR\bin directory to your system PATH variable?

Re: Getting Matlab OpenSim interface to work

Posted: Mon Feb 13, 2017 4:47 pm
by jimmy
If you are running a newer version of Matlab, the automated method may not be working correctly. This is because we haven't had a new OpenSim release in awhile.

Have you tried the manual method (detailed on the page you linked)? I would make sure that LibraryPath.txt, classpath.txt are correct and OpenSim/bin is in the Matlab path. Make sure you restart Matlab (I have forgotten that in the past).

Re: Getting Matlab OpenSim interface to work

Posted: Mon Feb 13, 2017 4:47 pm
by vrutang
Yes, I have added. Just now my problem is solved.

I just closed Matlab and open once again, set the path OpenSim 3.3/bin
and type: "model = org.opensim.modeling.Model()" and it did worked without any error.

Now I am able to run example codes.

Thanks for all your time and help!

Re: Getting Matlab OpenSim interface to work

Posted: Thu Aug 24, 2017 1:15 am
by jskaro
Hi,
I'm getting the same errors as well. I've done the manual setup for matlab to opensim and importing the models works. When I try to run the "createActuatorsFile.m" it get the following errors,

"Required library failed to load. Check that the dynamic library osimJavaJNI is in your PATH"
"java.lang.UnsatisfiedLinkError:C:\OpenSim 3.3\bin\osimJavaJNI.dll: Can't find dependent libraries"

I've also gone through the troubleshooting on https://simtk-confluence.stanford.edu:8 ... ith+Matlab
as in I made sure OpenSim was in the system path when I installed it. I did get a path too long error though. Then I've reinstalled visual studio package.

Been struggling with this for a while.

Thanks in advance for any help!