Menu
AWS SDK for Java
Developer Guide

Set up the AWS SDK for Java

Describes how to use the AWS SDK for Java in your project.

Prerequisites

To use the AWS SDK for Java, you must have:

Including the SDK in your project

To include the SDK your project, use one of the following methods depending on your build system or IDE:

  • Apache Maven– If you use Apache Maven, you can specify the entire SDK (or specific SDK components) as dependencies in your project. See Using the SDK with Apache Maven for details about how to set up the SDK when using Maven.

  • Gradle– If you use Gradle, you can import the Maven Bill of Materials (BOM) in your Gradle project to automatically manage SDK dependencies. See Using the SDK with Gradle for more infomation.

  • Eclipse IDE– If you use the Eclipse IDE, you may want to install and use the AWS Toolkit for Eclipse, which will automatically download, install and update the Java SDK for you. For more information and setup instructions, see the AWS Toolkit for Eclipse User Guide.

If you intend to build your projects using a different IDE, with Apache Ant or by any other means, then download and extract the SDK as shown in the next section.

Downloading and extracting the SDK

We recommend that you use the most recent pre-built version of the SDK for new projects, which provides you with the latest support for all AWS services.

Note

For information about how to download and build previous versions of the SDK, see Installing previous versions of the SDK.

To download and extract the latest version of the SDK

  1. Download the SDK from https://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip.

  2. After downloading the SDK, extract the contents into a local directory.

The SDK contains the following directories:

  • documentation– contains the API documentation (also available on the web: AWS SDK for Java API Reference).

  • lib– contains the SDK .jar files.

  • samples– contains working sample code that demonstrates how to use the SDK.

  • third-party– contains third-party libraries that are used by the SDK, such as Apache commons logging, AspectJ and the Spring framework.

To use the SDK, add the full path to the lib and third-party directories to the dependencies in your build file, and add them to your java CLASSPATH to run your code.

Installing previous versions of the SDK

Only the latest version of the SDK is provided in pre-built form. However, you can build a previous version of the SDK using Apache Maven (open source). Maven will download all necessary dependencies, build and install the SDK in one step. Visit http://maven.apache.org/ for installation instructions and more information.

To install a previous version of the SDK

  1. Go to the SDK's GitHub page at: AWS SDK for Java (GitHub).

  2. Choose the tag corresponding to the version number of the SDK that you want. For example, 1.6.10.

  3. Click the Download ZIP button to download the version of the SDK you selected.

  4. Unzip the file to a directory on your development system. On many systems, you can use your graphical file manager to do this, or use the unzip utility in a terminal window.

  5. In a terminal window, navigate to the directory where you unzipped the SDK source.

  6. Build and install the SDK with the following command (Maven required):

    Copy
    mvn clean install

    The resulting .jar file is built into the target directory.

  7. (Optional) Build the API Reference documentation using the following command:

    Copy
    mvn javadoc:javadoc

    The documentation is built into the target/site/apidocs/ directory.

Installing a Java Development Environment

The AWS SDK for Java requires J2SE Development Kit 6.0 or later. You can download the latest Java software from http://www.oracle.com/technetwork/java/javase/downloads/.

Important

Java version 1.6 (JS2E 6.0) did not have built-in support for SHA256-signed SSL certificates, which are required for all HTTPS connections with AWS after September 30, 2015.

Java versions 1.7 or newer are packaged with updated certificates and are unaffected by this issue.

Choosing a JVM

For the best performance of your server-based applications with the AWS SDK for Java, we recommend that you use the 64-bit version of the Java Virtual Machine (JVM). This JVM runs only in server mode, even if you specify the -Client option at run time.

Using the 32-bit version of the JVM with the -Server option at run time should provide comparable performance to the 64-bit JVM.