Can't configure opensim in matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Kirstie Devin
Posts: 6
Joined: Fri Mar 27, 2020 3:06 am

Can't configure opensim in matlab

Post by Kirstie Devin » Wed Jul 01, 2020 6:54 am

I have been following instructions described at https://simtk-confluence.stanford.edu/d ... vironment . I have added C\OpenSim\4.1 to my environment path, and run the configureOpenSim.m file as instructed, then restart matlab. However, when I return to my script and enter 'model = org.opensim.modeling.Model();', it comes up with the following message:

>> model = org.opensim.modeling.Model();
Java exception occurred:
java.lang.UnsatisfiedLinkError: org.opensim.modeling.opensimSimulationJNI.new_Model__SWIG_0()J

at org.opensim.modeling.opensimSimulationJNI.new_Model__SWIG_0(Native Method)

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

When I try running org.opensim.modeling.opensimCommon.GetVersion(), this is the message I get:

>> org.opensim.modeling.opensimCommon.GetVersion()
Java exception occurred:
java.lang.UnsatisfiedLinkError: org.opensim.modeling.opensimCommonJNI.GetVersion()Ljava/lang/String;

at org.opensim.modeling.opensimCommonJNI.GetVersion(Native Method)

at org.opensim.modeling.opensimCommon.GetVersion(opensimCommon.java:25)

I have OpenSim\4.1\bin added to my path, and I had a look at the application in question and the dll application is there, so I don't know why this isn't working? I have also been running it as admin user. Any help would be much appreciated, as I would like to continue and create my own model using OpenSim if possible.

Thanks in advance!

Tags:

User avatar
Ayman Habib
Posts: 2252
Joined: Fri Apr 01, 2005 12:24 pm

Re: Can't configure opensim in matlab

Post by Ayman Habib » Wed Jul 01, 2020 10:01 am

Hello,

You can check if the path setting is correct by typing opensim-cmd from the command prompt. If not found then your path setting is incorrect.

Unless you intentionally modified the install path, it looks like the path specification is incorrect. We typically install in "C:/OpenSim 4.1" while you refer to "C:/OpenSim/4.1" Please make sure spaces in file paths are accounted for correctly or install in a folder that has no spaces in it (e.g. C:/OpenSim_4.1) and redo the configuration/path-setting procedure.

Please let us know how it goes,
-Ayman

User avatar
Andrew Kraszewski
Posts: 3
Joined: Wed Dec 19, 2007 6:07 am

Re: Can't configure opensim in matlab

Post by Andrew Kraszewski » Tue Jul 07, 2020 10:57 am

I have the same message in MATLAB 2020a and can't find any mistake. Followed all instructions and I believe the system variable is correct (OPENSIM path setting near bottom of pic):
path variables.JPG
path variables.JPG (244.52 KiB) Viewed 254 times
My javalibrarypath.txt file has one line: "C:\OpenSim 4.1\bin"
My javaclasspath.txt file also has one line: "C:\OpenSim 4.1\sdk\Java\org-opensim-modeling.jar"

Last, I installed the latest Visual Studio redistribution package as suggested in the documentation.

Any help would be appreciated, many thanks in advance!

-Andrew Kraszewski

User avatar
Ayman Habib
Posts: 2252
Joined: Fri Apr 01, 2005 12:24 pm

Re: Can't configure opensim in matlab

Post by Ayman Habib » Tue Jul 07, 2020 11:55 am

Hi Andrew,
1. There's no use of an environment variable OPENSIM, it is not used by the code.
2. The relevant part of the environment which is not shown is Path and that should include C:\OpenSim 4.1\bin

Please let us know if you set the path or what you see when you type opensim-cmd at the command prompt.

Best regards,
-Ayman

User avatar
Andrew Kraszewski
Posts: 3
Joined: Wed Dec 19, 2007 6:07 am

Re: Can't configure opensim in matlab

Post by Andrew Kraszewski » Tue Jul 07, 2020 2:17 pm

Hi Ayman,

That was it! I didn't understand/forgot how to add a Path system variable.
correct path setting.JPG
correct path setting.JPG (327.94 KiB) Viewed 226 times
I have a small request and that is to make this step a little clearer in the "Scripting with Matlab" documentation, i.e. Step 5 under "Setting up your Matlab Scripting Environment"; the link to the Java support page is helpful but maybe a picture could really help. Feel free to use my above pic to guide others with the same issue.

Thanks so much!

Best,
Andrew

User avatar
Ayman Habib
Posts: 2252
Joined: Fri Apr 01, 2005 12:24 pm

Re: Can't configure opensim in matlab

Post by Ayman Habib » Wed Jul 08, 2020 9:53 am

Thanks Andrew,

Much appreciated. I just posted an image to the documentation based on the image you sent.
https://simtk-confluence.stanford.edu/d ... nvironment

All the best,
-Ayman

User avatar
Kirstie Devin
Posts: 6
Joined: Fri Mar 27, 2020 3:06 am

Re: Can't configure opensim in matlab

Post by Kirstie Devin » Thu Jul 09, 2020 7:48 am

Hi all,

Thank you so much for your help so far, I really appreciate it. I don't think I was setting the path correctly.

In any case, I decided to start from scratch by reinstalling opensim, but now whenever I try to run configureOpenSim, I keep getting an error saying 'The folder you selected is not an OpenSim installation' whenever I choose C:\OpenSim 4.1\. Do you know why this is?

Thanks in advance!
Attachments
errorMessageFor_configureOpenSim.PNG
errorMessageFor_configureOpenSim.PNG (6.31 KiB) Viewed 192 times

User avatar
Kirstie Devin
Posts: 6
Joined: Fri Mar 27, 2020 3:06 am

Re: Can't configure opensim in matlab

Post by Kirstie Devin » Thu Jul 09, 2020 8:37 am

Hi again,

Please ignore my previous message, I have managed to sort it! I think it was related to the fact that I reinstalled OpenSim but still had the old code and model files stored in my "C:\Users\<username>\OpenSim\4.1\). I may also have messed around with them a bit when I was originally trying to resolve this issue, so that's probably why it stopped working.

Thank you so much for your help! I've been struggling with this for a while now, so I really do appreciate it :D

POST REPLY