Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Obtaining and Installing the SDK

Updated on 2025-02-11 GMT+08:00

Installing Java SDKs

You can install Java SDKs in either of the following ways:

Obtaining DLI SDKs

  1. Log in to the DLI management console.
  2. On the Overview page, click SDK Download under Common Links.
  3. On the DLI SDK DOWNLOAD page, select a driver and download it.
    Obtain the dli-sdk-java-x.x.x.zip package and decompress it. The following table shows the directory structure of the package.
    Table 1 Directory structure

    Parameter

    Description

    jars

    SDK and its dependent JAR packages.

    maven-install

    Script and JAR package that are installed in the local Maven repository.

    dli-sdk-java.version

    Java SDK version description.

Method 1: Installing DLI SDK Dependencies Using Maven

You are advised to install dependencies using Maven to use Huawei Cloud Java SDKs.

  • Installing service-level SDK dependencies
    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.

      Taking the example of importing the latest version of the SDK, obtain the latest version of the SDK package and replace the version in the code.

      1
      2
      3
      4
      5
       <dependency>
          <groupId>com.huawei.dli</groupId>
          <artifactId>huaweicloud-dli-sdk-java</artifactId>
          <version>x.x.x</version>
       </dependency>
      
  • Installing SDK dependencies of other services

    DLI depends on SDKs (for example, OBS SDK), which can be downloaded by configuring the Maven image source repository of Huawei Cloud.

    • (Recommended) Using the Huawei image source as the main repository:

      For how to configure the Huawei Maven image source, visit Huawei open source image site, select Huawei SDK, and click HuaweiCloud SDK.

      If you build a project with Maven, modify the settings.xml file by adding the following content:

      1. Add the following content to the profiles node:
        <profile>
            <id>MyProfile</id>
            <repositories>
                <repository>
                    <id>HuaweiCloudSDK</id>
                    <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>HuaweiCloudSDK</id>
                    <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
      2. Add the following information to the mirrors node:
        <mirror>
            <id>huaweicloud</id>
            <mirrorOf>*,!HuaweiCloudSDK</mirrorOf>
            <url>https://repo.huaweicloud.com/repository/maven/</url>
        </mirror>
      3. Add the activeProfiles tag to activate the configurations.
        <activeProfiles>
          <activeProfile>MyProfile</activeProfile>
        </activeProfiles>
    • Use a non-Huawei image source as the main repository (for example, a user-defined image source) to use HuaweiCloud SDKs:

      If you build a project with Maven, modify the settings.xml file as follows:

      <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
          <servers>
      	 <server>
            <id>demo-releases</id>    
            <username>deployment</username>    
            <password><![CDATA[xxx]]></password>  
          </server>    
        </servers>
        <mirrors>
          <mirror>     
            <id>demo-releases</id>     
            <mirrorOf>*,!HuaweiCloudSDK</mirrorOf>     
            <url>http://maven.demo.com:8082/demo/content/groups/public</url>     
          </mirror>    
        </mirrors>
        <profiles>
          <profile>    
            <id>demo</id>
            <activation>
              <activeByDefault>true</activeByDefault>
              <jdk>1.8</jdk>
            </activation> 
            <properties>
              <maven.compiler.source>1.8</maven.compiler.source>
              <maven.compiler.target>1.8</maven.compiler.target>
              <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 
            </properties>
            <repositories>    
               <repository>    
                <id>demo-releases</id>    
                <url>http://demo-releases</url>    
                <releases>
                  <enabled>true</enabled>
                </releases>    
                <snapshots>
                  <enabled>true</enabled>
                </snapshots>    
              </repository> 
            </repositories>
            <pluginRepositories>    
               <pluginRepository>    
                  <id>demo-releases</id>    
                  <url>http://demo-releases</url>    
                  <releases>
                    <enabled>true</enabled>
                  </releases>    
                  <snapshots>
                    <enabled>true</enabled>
                  </snapshots>    
                </pluginRepository>
            </pluginRepositories>    
          </profile>
          <profile>
            <id>huaweicloudrepo</id>
            <repositories>
              <repository>
                <id>HuaweiCloudSDK</id>
                <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                <releases>
                  <enabled>true</enabled>
                </releases>
                <snapshots>
                  <enabled>false</enabled>
                </snapshots>
              </repository>
            </repositories>
            <pluginRepositories>
              <pluginRepository>
                <id>HuaweiCloudSDK</id>
                <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                <releases>
                  <enabled>true</enabled>
                </releases>
                <snapshots>
                  <enabled>false</enabled>
                </snapshots>
              </pluginRepository>
            </pluginRepositories>
          </profile> 
        </profiles>
        <activeProfiles>
          <activeProfile>demo</activeProfile>
          <activeProfile>huaweicloudrepo</activeProfile>
        </activeProfiles>
      </settings>

Method 2: Installing the SDK by Importing JAR Files to Eclipse

To import JAR files into an Eclipse integrated development environment project, follow these steps.

  1. Download Eclipse IDE for Java Developers of the latest version from the Eclipse's official website and install it. Configure the JDK in Eclipse.

    1. Create a project and select the correct JRE version. For details, see Figure 1.
      Figure 1 Creating a project

  2. Configure and import the SDK JAR file.

    1. Right-click JRE System Library and choose Build Path > Configure Build Path from the shortcut menu. For details, see Figure 2.
      Figure 2 Configuring the project path
    2. Click Add External JARs, select the downloaded JAR file obtained in Obtaining DLI SDKs, and click OK.
      Figure 3 Selecting the SDK JAR file

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback