# I'm trying to use AMPL() in MATLAB

**URL:** <https://discuss.ampl.com/t/im-trying-to-use-ampl-in-matlab/1945>\
**Category:** Support\
**Tags:** general, errors-and-messages\
**Created:** [October 10, 2024, 3:00pm UTC](https://discuss.ampl.com/t/im-trying-to-use-ampl-in-matlab/1945 "2024-10-10T15:00:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![annag](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@annag](https://discuss.ampl.com/u/annag)\
**Post date:** [October 10, 2024, 3:00pm UTC](https://discuss.ampl.com/t/im-trying-to-use-ampl-in-matlab/1945/1 "2024-10-10T15:00:20Z")

</div>

I have a problem with AMPL API in MATLAB, this is the error ''Error in AMPL (line 111)  
a = com.ampl.AMPL(); ‘’  
I add the directory path of AMPL and also the javapat with the file ampl-java.jar ,but i have still the error. What can i do ?

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [October 16, 2024, 2:13pm UTC](https://discuss.ampl.com/t/im-trying-to-use-ampl-in-matlab/1945/2 "2024-10-16T14:13:33Z")

</div>

Hi @annag,

Thank you for reaching out. What happens when you run setupOnce [Initial Setup — AMPL API 2.1.4 documentation](https://ampl.com/api/latest/matlab/getting-started.html#initial-test)?
