Getting started with the Java SDK
This guide provides a foundational introduction to the Couchbase Java SDK. It shows you how to install the SDK and write a basic sample application that highlights important aspects. After you install the SDK, you can start exploring it on your own or proceed with a tutorial to build a complete, production-grade application.
Installing the Couchbase Java SDK
At a minimum, Java 6 is required, but any newer version is also supported (including Java 8).
To use the Java SDK, point your application project object model (POM) to the library, which is available on Maven Central. Here is a typical pom.xml that you can copy and paste into your Java project:
<dependencies> <dependency> <groupId>com.couchbase.client</groupId> <artifactId>java-client</artifactId> <version>2.1.6</version> </dependency> </dependencies>
You can also download an archive that has all JARs and dependencies included. In general, using a package manager is strongly recommended. See the "Download and API Reference" section for more details.
If you import the dependency, the following transitive dependencies are also added:
- core-io : our internal core library, which abstracts lots of Couchbase-specific behavior in a message-oriented way.
- RxJava : a foundational library to build powerful reactive and asynchronous applications.
The SDK itself depends on more packages (like Netty, the Disruptor RingBuffer and Jackson), but they are repackaged into the distributed JAR to reduce the risk of dependency clashes in your environment.