Getting Matlab OpenSim interface to work

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Sarah Wohlman
Posts: 7
Joined: Fri Feb 25, 2011 1:37 pm

Getting Matlab OpenSim interface to work

Post by Sarah Wohlman » Wed Apr 16, 2014 12:21 pm

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!

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Getting Matlab OpenSim interface to work

Post by jimmy d » Wed Apr 16, 2014 12:33 pm

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?

User avatar
Sarah Wohlman
Posts: 7
Joined: Fri Feb 25, 2011 1:37 pm

Re: Getting Matlab OpenSim interface to work

Post by Sarah Wohlman » Wed Apr 16, 2014 2:27 pm

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.

User avatar
Vrutangkumar Shah
Posts: 3
Joined: Mon Feb 06, 2017 4:55 pm

Re: Getting Matlab OpenSim interface to work

Post by Vrutangkumar Shah » Mon Feb 13, 2017 1:31 pm

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.
Attachments
Capture.PNG
Capture.PNG (39.76 KiB) Viewed 2774 times

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Getting Matlab OpenSim interface to work

Post by jimmy d » Mon Feb 13, 2017 1:58 pm

Hi-

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

-j

User avatar
Vrutangkumar Shah
Posts: 3
Joined: Mon Feb 06, 2017 4:55 pm

Re: Getting Matlab OpenSim interface to work

Post by Vrutangkumar Shah » Mon Feb 13, 2017 4:11 pm

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!
Attachments
Capture.PNG
Capture.PNG (47.03 KiB) Viewed 2756 times

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: Getting Matlab OpenSim interface to work

Post by Thomas Uchida » Mon Feb 13, 2017 4:43 pm

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?

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Getting Matlab OpenSim interface to work

Post by jimmy d » Mon Feb 13, 2017 4:47 pm

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).

User avatar
Vrutangkumar Shah
Posts: 3
Joined: Mon Feb 06, 2017 4:55 pm

Re: Getting Matlab OpenSim interface to work

Post by Vrutangkumar Shah » Mon Feb 13, 2017 4:47 pm

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!

User avatar
Jordan Skaro
Posts: 1
Joined: Wed Feb 24, 2016 10:24 pm

Re: Getting Matlab OpenSim interface to work

Post by Jordan Skaro » Thu Aug 24, 2017 1:15 am

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!

POST REPLY