rabbitmq/rabbitmq-tutorials

different implementations of line 13 Channel and Connection in rabbitmq-tutorials/java/Send.java

QSpSchool opened this issue · 2 comments

This is the error I get, which i find strange because https://www.rabbitmq.com/tutorials/tutorial-one-java.html shows That both Channel and Connection implements java.io.AutoCloseable, which isn't the case anymore. Maybe update Hello-world page?

java: incompatible types: try-with-resources not applicable to variable type
(com.rabbitmq.client.Channel cannot be converted to java.lang.AutoCloseable)

afbeelding

shows That both Channel and Connection implements java.io.AutoCloseable,

Where is that shown, exactly? The code samples on that web page link back to this repository.

I tried the following steps:

git clone https://github.com/rabbitmq/rabbitmq-tutorials.git
cd rabbitmq-tutorials/java
wget http://central.maven.org/maven2/com/rabbitmq/amqp-client/5.5.1/amqp-client-5.5.1.jar
wget http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar
wget http://central.maven.org/maven2/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar
javac -cp .:amqp-client-5.5.1.jar:slf4j-api-1.7.25.jar:slf4j-simple-1.7.25.jar Send.java
java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

And the compiler doesn't complain about Channel not implementing AutoCloseable. Maybe something wrong with the IDE configuration/Java version/AMQP client version. Please move this to the mailing list.