Skip to content

Commit 7116bd0

Browse files
Merge pull request rabbitmq#116 from rabbitmq/java-tutorials-build
Update Java build instructions
2 parents 07e659a + cb97992 commit 7116bd0

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

java/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ To successfully use the examples you will need a running RabbitMQ server.
77

88
## Requirements
99

10-
You'll need to download the RabbitMQ
11-
[java client library package](http://www.rabbitmq.com/java-client.html),
12-
and check its signature as described there.
13-
Unzip it into your working directory and ensure the JAR files from the
14-
unzipped directory are placed in your working directory:
10+
You'll need to download the following JAR files
11+
from Maven Central:
12+
13+
* [RabbitMQ Java Client](http://central.maven.org/maven2/com/rabbitmq/amqp-client/4.0.2/amqp-client-4.0.2.jar)
14+
* [SLF4J API](http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar)
15+
* [SLF4J Simple](http://central.maven.org/maven2/org/slf4j/slf4j-simple/1.7.22/slf4j-simple-1.7.22.jar)
1516

16-
$ unzip rabbitmq-java-client-bin-*.zip
17-
$ cp rabbitmq-java-client-bin-*/*.jar ./
17+
Copy those files in your working directory, along the tutorials Java files.
1818

19-
To compile you only need the Rabbitmq java client jar on the classpath.
19+
To compile you only need the Rabbitmq Java Client jar on the classpath.
2020

2121
To run them you'll need all the dependencies, see examples below.
2222

@@ -25,33 +25,33 @@ use a semicolon instead of a colon to separate items in the classpath.
2525

2626
> You can set an environment variable for the jar files on the classpath e.g.
2727
>
28-
> $ export CP=.:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar
28+
> $ export CP=.:amqp-client-4.0.2.jar:slf4j-api-1.7.21.jar:slf4j-simple-1.7.22.jar
2929
> $ java -cp $CP Send
3030
>
3131
> or on Windows:
3232
>
33-
> > set CP=.;commons-io-1.2.jar;commons-cli-1.1.jar;rabbitmq-client.jar
33+
> > set CP=.;amqp-client-4.0.2.jar;slf4j-api-1.7.21.jar;slf4j-simple-1.7.22.jar
3434
> > java -cp %CP% Send
3535
3636
## Code
3737

3838
[Tutorial one: "Hello World!"](http://www.rabbitmq.com/tutorial-one-java.html):
3939

40-
$ javac -cp rabbitmq-client.jar Send.java Recv.java
40+
$ javac -cp amqp-client-4.0.2.jar Send.java Recv.java
4141

42-
$ java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar Send
43-
$ java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar Recv
42+
$ java -cp .:amqp-client-4.0.2.jar:slf4j-api-1.7.21.jar:slf4j-simple-1.7.22.jar Send
43+
$ java -cp .:amqp-client-4.0.2.jar:slf4j-api-1.7.21.jar:slf4j-simple-1.7.22.jar Recv
4444

4545
[Tutorial two: Work Queues](http://www.rabbitmq.com/tutorial-two-java.html):
4646

47-
$ javac -cp rabbitmq-client.jar NewTask.java Worker.java
47+
$ javac -cp amqp-client-4.0.2.jar NewTask.java Worker.java
4848

4949
$ java -cp $CP NewTask
5050
$ java -cp $CP Worker
5151

5252
[Tutorial three: Publish/Subscribe](http://www.rabbitmq.com/tutorial-three-java.html)
5353

54-
$ javac -cp rabbitmq-client.jar EmitLog.java ReceiveLogs.java
54+
$ javac -cp amqp-client-4.0.2.jar EmitLog.java ReceiveLogs.java
5555

5656
$ java -cp $CP ReceiveLogs
5757
$ java -cp $CP EmitLog

java/recompile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
javac -cp .:rabbitmq-client.jar *.java
3+
javac -cp .:amqp-client-4.0.2.jar:slf4j-api-1.7.21.jar:slf4j-simple-1.7.22.jar *.java

0 commit comments

Comments
 (0)