Skip to main content
Version: 3.1.x

Set up Java client

Install Java client library

The latest version of the Pulsar Java client library is available via Maven Central. To use the latest version, add the pulsar-client library to your build configuration.



If you use Maven, add the following information to the pom.xml file.

<!-- in your <properties> block -->

<!-- in your <dependencies> block -->


If you use Gradle, add the following information to the build.gradle file.

def pulsarVersion = '3.1.2'

dependencies {
compile group: 'org.apache.pulsar', name: 'pulsar-client', version: pulsarVersion

Connect to Pulsar cluster

To connect to Pulsar using client libraries, you need to specify a Pulsar protocol URL.

You can assign Pulsar protocol URLs to specific clusters and use the pulsar scheme. The following is an example of localhost with the default port 6650:


If you have multiple brokers, separate IP:port by commas:


If you use mTLS authentication, add +ssl in the scheme: