Skip to content

Commit a16276e

Browse files
author
Ann Witbrock
committed
use env var for classpath jars
1 parent 70dd5b1 commit a16276e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

java/README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@ unzipped directory are placed in your working directory:
1414
$ unzip rabbitmq-java-client-bin-*.zip
1515
$ cp rabbitmq-java-client-bin-*/*.jar ./
1616

17-
To compile you only need the Rabbitmq java client on the classpath.
17+
To compile you only need the Rabbitmq java client jar on the classpath.
1818

1919
To run them you'll need all the dependencies, see examples below.
2020

2121
Note: If you're on Windows,
2222
use a semicolon instead of a colon to separate items in the classpath.
2323

24+
> You can set an environment variable for the jar files on the classpath e.g.
25+
>
26+
> $ export CP=.:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar
27+
> $ java -cp $CP Send
28+
>
29+
> or on Windows:
30+
>
31+
> > set CP=.;commons-io-1.2.jar;commons-cli-1.1.jar;rabbitmq-client.jar
32+
> > java -cp %CP% Send
33+
2434
## Code
2535

2636
[Tutorial one: "Hello World!"](http://www.rabbitmq.com/tutorial-one-java.html):
@@ -34,14 +44,14 @@ use a semicolon instead of a colon to separate items in the classpath.
3444

3545
$ javac -cp rabbitmq-client.jar NewTask.java Worker.java
3646

37-
$ java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar NewTask
38-
$ java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar Worker
47+
$ java -cp $CP NewTask
48+
$ java -cp $CP Worker
3949

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

4252
$ javac -cp rabbitmq-client.jar EmitLog.java ReceiveLogs.java
4353

44-
$ java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar EmitLog
45-
$ java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar ReceiveLogs
54+
$ java -cp $CP EmitLog
55+
$ java -cp $CP ReceiveLogs
4656

4757

0 commit comments

Comments
 (0)