- 3 years ago 103
Java Question

Understanding ZooKeeper startup command line

I was reading the

ZooKeeper Cluster Set-Up Document
from here .

But unfortunately can't understand the java command to start up ZooKeeper service.

$ java -cp zookeeper.jar:lib/log4j-1.2.15.jar:conf \ org.apache.zookeeper.server.quorum.QuorumPeerMain zoo.cfg

As far as I knew(Please correct if I was wrong.thanks),
means the reference libraries of the executable jar
is the main class which command needed. and
means the argument of the main class.

What I can't understand is the
:conf \
part. What does it mean?

I tried to read the document from Java document. But didn't anything helpful.

Could someone please help to shed some light on it ?Thanks.

Answer Source

The conf part adds classes and resources from the conf directory to the classpath.

The classpath contains three entries:

  • zookeeper.jar, i.e. the Zookeeper JAR file in the current working directory
  • lib/log4j-1.2.15.jar, i.e. the Log4J JAR file in the lib directory
  • conf, i.e. all compiled classes and resources in the conf directory

The backslash is just there to indicate to the shell that the command continues on the next line.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download