MATLAB Answers

Undefined variable "com" or class "com.mathw​orks.mqttc​lient.clie​nt.Client" of MQTT in standalone GUI

7 views (last 30 days)
Chien-Hsi Chen
Chien-Hsi Chen on 27 Nov 2018
Commented: Chien-Hsi Chen on 6 Dec 2019
Hello everyone,
I'm using R2018b with the toolbox MQTT in Matlab.
However, I got the error of "Undefined variable "com" or class "com.mathworks.mqttclient.client.Client"". In my case is that I try to use this MQTT in a GUI which I made with GUIDE, but somehow it only works in the Matlab IDE but not in the compiled standalone version (all the .p files in MQTT in Matlab have been added manually).
I also tried to include both .jar files before compiling them, but it doesn't work and Matlab will complain that the pathway of these two files have been specified.
Does anyone maybe have a solution in detailed steps?
Thank you in advance!


Show 1 older comment
Timm Rudolph
Timm Rudolph on 6 Dec 2019
can you explain exactly how you did it?
I have the same problem. Did you use a lokal Broker?
I want to try it with a mosquitto lokal Broker.
Chien-Hsi Chen
Chien-Hsi Chen on 6 Dec 2019
Hi there,
it's been a while since I worked in that project.
I didn't use a local broker but connect to a server in antoher institute.
If you have the same problem as I did before, I assume you also have a GUI and want to compile it into a standalone version.
  1. Download the MQTT toolbox and install on your computer
  2. Find the directory of this toolbox where it is installed
  3. Include all the files in the folder during the application compiler.
This steps should work. If not, maybe you need to contact the official support for the help.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by