See the Pinecone Java SDK documentation for full installation instructions and usage examples. If you’re migrating from version 0.8.x or below, see the Java SDK v1.0.0 migration guide. If you’re migrating from v1.x to v2.0.0, see the Java SDK v2.0.0 migration guide.

Install

To install the latest version of the Java SDK:

  • Make sure you have at least Java 1.8 installed.

  • Add a dependency to the current module:

    Java
    // Maven
    <dependency>
      <groupId>io.pinecone</groupId>
      <artifactId>pinecone-client</artifactId>
      <version>2.0.0</version>
    </dependency>
    
    // Gradle
    implementation "io.pinecone:pinecone-client:2.0.0"
    

    Alternatively, you can download the standalone uberjar pinecone-client-2.0.0-all.jar, which bundles the Pinecone SDK and all dependencies together. You can include this in your classpath like you do with any third-party JAR without having to obtain the pinecone-client dependencies separately.

Initialize

Once installed, you can import the SDK and then use an API key to initialize a client instance:

import io.pinecone.clients.Pinecone;
import org.openapitools.control.client.model.*;

public class InitializeClientExample {
    public static void main(String[] args) {
        Pinecone pc = new Pinecone.Builder("YOUR_API_KEY").build();
    }
}

Was this page helpful?