Help Center/ ImageSearch/ SDK Reference/ Using the SDK (Java)/ Obtaining and Installing the Java SDK
Updated on 2022-02-22 GMT+08:00

Obtaining and Installing the Java SDK

You are advised to use the Java SDK for ImageSearch by installing dependencies through Apache Maven.

  1. Download and install Apache Maven on your operating system.
  2. After installing and configuring Maven, run the mvn -v command. Maven is installed successfully if the following information is displayed.

  3. Add dependencies to an existing Maven project or use an integrated development environment (IDE) to create a Maven project.

    For example, to create a Maven project using IntelliJ IDEA, perform the following steps (skip them if you already have a Maven project):

    1. Start IntelliJ IDEA.
    2. Choose File > New > project...
    3. In the displayed New Project dialog box, click Maven and then Next.
    4. Specify GroupId and ArtifactId, and click Next.
    5. Specify Project name and Project location, and click Finish.

  4. Add dependency items to the pom.xml file of the Maven project.

    The following are dependencies for ImageSearch SDK 3.0.55:

    <dependency> 
        <groupId>com.huaweicloud.sdk</groupId> 
        <artifactId>huaweicloud-sdk-imagesearch</artifactId> 
        <version>3.0.67</version> 
    </dependency>

    The following sample code uses the fastjson dependency (ignore and delete it if it is not required):

    <dependency> 
        <groupId>com.alibaba</groupId> 
        <artifactId>fastjson</artifactId> 
        <version>1.2.70</version> 
    </dependency>