Couchbase Lite on Java — Prerequisites

      +

      Description — Couchbase Lite on Java — a framework for developing offline-first Java applications for mobile and edge
      Abstract — This content identities the pre-requisites and preparatory steps to be considered before installing Couchbase Lite for java

      Introduction

      Couchbase Lite on Java enables development and deployment of Couchbase Lite applications to a JVM environment. You can deploy to a desktop or web server (for example, Tomcat), including embedded Tomcat deployments.

      We use Intellij IDEA, gradle, Maven and Tomcat as tools to build and run the examples presented in this content. You are free to use the tools of your choice.

      Install Server Software

      If you want to use Couchbase Lite on Java with Couchbase Server and-or Sync Gateway you will need to have installed operational instances of these before completing the installation and test build steps.

      So, If you have not already done so, see Prepare Sync Gateway

      • Within Couchbase Server, create a bucket named getting-started.cblite2

      • Create a RBAC user for Sync Gateway with username = sync-gateway and password = password

      MacOS and Windows

      You may now proceed directly to Couchbase Lite on Java — Installing.

      Additional Steps For Linux

      Before proceeding to Couchbase Lite on Java — Installing, you will need to setup your build and runtime environments, and make the supplied support libraries available.

      Steps

      1. Download the zip file from here — https://packages.couchbase.com/releases/couchbase-lite-java/3.1.3/couchbase-lite-java-linux-supportlibs-3.1.3.zip .

      2. Unpack the downloaded file to a location accessible to — and usable by — your build and runtime environments, for example your_dir/couchbase-lite-java-3.1.3.

      3. Include the following dependency in your build.gradle file:

        Dependencies {
          implementation fileTree(include: ['*.jar'], dir: your_dir/couchbase-lite-java-3.1.3)
        }
      4. Set up the Native Libraries for Linux. You will need to add the paths of the directories <lib-directory>/support/libc++ and <lib-directory>/support/libicu to the Java system property java.library.path.

      The simplest way to set this is normally through the shell variable LD_LIBRARY_PATH.

      • Web Service/Tomcat

      • Desktop

      Add the variables to your $CATALINA_BASE/bin/setenv.sh. (If the setenv.sh file doesn’t exist, you will need to create a new file.)

      LD_LIBRARY_PATH=<lib-directory>/support/libC++:<lib-directory>/support/libicu:$LD_LIBRARY_PATH

      Export the variable in your .bashrc file:

      export LD_LIBRARY_PATH=<lib-directory>/support/libC++:<lib-directory>/support/libicu:$LD_LIBRARY_PATH

      Please refer to the Linux Platform Support section for the minimum version requirements of those libraries.