Install SDK for Java
Prerequisites
Before you install and use Zenlayer Cloud SDK for Java, make sure that the following requirements are met:
The Java environment is installed. Java Development Kit (JDK) version 1.7 or later is used.
A Zenlayer Cloud account is created and an Access Key ID and an Access Key Password are created. See Generate an API Access Key for more details.
Obtain the service domain name. Currently the service domain name requested by Zenlayer Cloud API is
console.zenlayer.com
.
Install SDK
Method 1: (Recommended) Add dependencies to your Maven project
If you use Maven to manage Java projects, you can add Maven dependencies to the pom.xml file to install Zenlayer Cloud SDK for Java. In the Maven repository, you can view the Maven dependencies of Zenlayer Cloud services.
Add the following Maven dependency to install the core library of Zenlayer Cloud SDK for Java.
Note
The version that is used in the preceding dependency is a sample version. For information about the latest version of the core library, visit the Maven repository.
Method 2: Import the JAR package to your project
Go to Github to download Java src.zip file.
Unzip the source code file (src.zip) to a suitable location for your project.
Put the decompressed JAR file in the path where Java can open it.
Refer to the following Example.
Example
Take CreateInstances
as an example, you need to fill in the following parameters in the sample code according to your actual situation.
<AccessKey>: your Access Key ID. See Obtain AccessKey for more details.
<AccessSecret>: your Access Key Password. See Obtain AccessKey for more details.
Last updated