All Products
Search
Document Center

Tablestore:Install Tablestore SDK for Java

Last Updated:Nov 08, 2024

After you install Tablestore SDK for Java, you can call the API operations of Tablestore SDK for Java when you write code. This topic describes how to install Tablestore SDK for Java.

Preparations

  • Java Development Kit (JDK) 6.0 or later is installed.

  • The Java development environment is installed, such as IntelliJ IDEA.

Installation methods

Important

When you use Tablestore SDK for Java, if the java.lang.ExceptionInInitializerError error occurs, PB library conflicts may exist in your project. For information about how to fix the issue, see What do I do if PB library conflicts occur when I use Tablestore SDK for Java?

You can install Tablestore SDK for Java by using one of the following two methods:

Add dependencies to a Maven project

To use Tablestore SDK for Java in a Maven project, you need to only add the corresponding dependencies to the pom.xml file. In this example, Tablestore SDK for Java V5.17.2 is used. Add the following content to <dependencies>:

Note

For more information about the version history of Tablestore SDK for Java, see Version history of Tablestore SDK for Java.

<dependency>
    <groupId>com.aliyun.openservices</groupId>
    <artifactId>tablestore</artifactId>
    <version>5.17.2</version>
</dependency>                 

Import the JAR package into Eclipse

In this example, Tablestore SDK for Java V5.17.2 is used. To import the JAR package into Eclipse, perform the following steps:

  1. Download the Tablestore SDK for Java package.

  2. Decompress the Tablestore SDK for Java package.

  3. Copy the tablestore-<versionId>.jar files and all JAR files in the lib folder to your project.

  4. <versionId> indicates the version number of Tablestore SDK for Java. For example, the file name for V5.17.2 is tablestore-5.17.2.jar.

  5. Right-click your project name in Eclipse and choose Properties > Java Build Path > Add JARs.

  6. Select all JAR files that you copied in Step 3.

Sample programs

Tablestore SDK for Java provides a variety of sample programs for your reference or use. You can decompress the downloaded SDK package and view the sample programs in the examples folder. For information about the download URL of the Tablestore SDK for Java package, visit GitHub.