Exception in thread "main" java.lang.Error: Unresolved compilation problem:
MAX_IP_MESSAGE_LENGTH cannot be resolved or is not a field
means the compiler can not find the (constant) value MAX_IP_MESSAGE_LENGTH
.
at net.wimpi.modbus.io.ModbusTCPTransport.prepareStreams(ModbusTCPTransport.java:223)
means that at line 223 of ModbusTCPTransport.java MAX_IP_MESSAGE_LENGTH
is referenced.
The problem is not in your code, but in the compilation of the jamod library. Have you copied the code of jamod to your project or have you included the jamod jar to your classpath? If the first then that is your problem, do the latter (use maven http://mvnrepository.com/artifact/net.wimpi/jamod/1.2).