paho.mqtt.java
paho.mqtt.java copied to clipboard
problem using the mqtt.jar file in a Java 10 project
Hi,
I'm trying to use the paho mqtt library in a Java 10 project. It works fine if I put the jar file on the class path. But if I move the jar to the module path and add the line requires org.eclipse.paho.client.mqttv; to module-info.java my project doesn't compile any more, giving the error message: error: module not found: org.eclipse.paho.client.mqttv requires org.eclipse.paho.client.mqttv;
The org.eclipse.paho.client.mqttv3-1.2.1-20180926.040552-201.jar is compiled with Java 1.8.0_162. Is the problem related to the automatic module generation in Java 10? Do you have a solution for this problem? When will a new org.eclipse.paho.client.mqttv.jar be released, which is compiled with a current Java version?
Best regards, Elke
- [x] Bug exists Release Version 1.2.0 ( Master Branch)
- [x] Bug exists in MQTTv3 Client on Snapshot Version 1.2.1-SNAPSHOT (Develop Branch)
- [x] Bug exists in MQTTv5 Client on Snapshot Version 1.2.1-SNAPSHOT (Develop Branch)
Hi, I've not tried to compile against Java 10 yet, but I imagine that if there are any issues then they will be resolved in the next release after this one.
I'm no expert on this, but org.eclipse.paho.client.mqttv the right name? I would have thought it should end with a 3 at least:
org.eclipse.paho.client.mqttv3
just checking.
You are right, org.eclipse.paho.client.mqttv3 is needed. But Netbeans can't find this module. If you put org.eclipse.paho.client.mqttv3-1.2.0.jar on the module path only the module org.eclipse.paho.client.mqttv is found.
I suppose that this is due to the automatic module detection, which interprets numeric characters at the end of a name as version number and therefore cuts it off. See: https://docs.oracle.com/javase/9/docs/api/java/lang/module/ModuleFinder.html
Hello,
I downloaded the source code of org.eclipse.paho.mqttv5.client Renamed package org.eclipse.paho.mqttv5 to org.eclipse.paho.mqttvv.client Add the src\main\java\module-info.java file:
module org.eclipse.paho.mqttvv.client {
requires transitive java.se;
exports org.eclipse.paho.mqttvv.client;
exports org.eclipse.paho.mqttvv.common;
exports org.eclipse.paho.mqttvv.common.packet;
}
Recompiled Then I was able to use the module.