0

I'm really new to Java so this might be a very easy one to solve. I'm having trouble in compiling my main .class file because of an import I do in the script. I have two imports that are both in the same "directory" (they come from the same .jar file. MqttMessage comes first in the code):

import org.eclipse.paho.mqttv5.common.MqttMessage;
import org.eclipse.paho.mqttv5.common.MqttException;

There comes no error with the import of MqttMessage, however there's an error when the program tries to import MqttException:

Error: Unable to initialize main class exemplo.Main
Caused by: java.lang.NoClassDefFoundError: org/eclipse/paho/mqttv5/common/MqttException

From what I can gather this error is related to the position of the classes, "directory" wise. However, considering these two classes are in the same "directory" I really don't know what the actual problem is or see how this could be solved. Any help would be very much appreciated.

  • In your Eclipse, Help - Install new Softrare - https://download.eclipse.org/releases/latest after that you should chose General Purpose Tools --> Eclipse Plug-in Development Environment after Install. https://stackoverflow.com/questions/40351279/the-import-org-eclipse-cannot-be-resolved-how-to-install-eclipse-plugin-develo – zoroglur Oct 20 '22 at 16:08

0 Answers0