All Products
Search
Document Center

Tablestore:Install Tablestore SDK for Java

Last Updated:Dec 27, 2024

Tablestore provides SDKs for multiple mainstream programming languages. This topic describes how to install Tablestore SDK for Java.

Prepare an environment

  • JDK 6.0 or later is available.

  • A Java development tool, such as IntelliJ IDEA and Eclipse, is installed.

Installation methods

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

Note

In the examples in this topic, Tablestore SDK for Java V5.17.2 is installed. For information about Tablestore SDK for Java of other versions, see Version history of Tablestore SDK for Java.

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. Add the following code to <dependencies> of the file:

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

Eclipse project

To use Tablestore SDK for Java in a Java project of Eclipse, import JAR packages into the project by performing the following steps:

  1. Download the Tablestore SDK for Java package.zip.

  2. Decompress the package.

  3. In Eclipse, select your project and choose Properties > Java Build Path > Libraries > Add External JARs.

  4. Go to the package folder that you decompressed in Step 2, select all JAR packages in the tablestore-5.17.2.jar package and the lib folder, and then click Open to import the JAR packages.

  5. Make sure that all the preceding JAR packages are imported to Libraries, and click Apply and Close to apply the project configuration.

Note

If you use JavaSE-9 or later, import the JAR packages to Modulepath of Libraries.

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.

References

After you install Tablestore SDK for Java, you must initialize an OTSClient instance for subsequent table and data operations. For more information, see Initialize an OTSClient instance.

FAQ

What do I do if a dependency conflict of the PB library occurs?

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