Skip to content
Advertisement

package com.amazonaws.services.lambda.runtime does not exist in AWS java sdk 1.10.2

I am trying the Java code example in the Getting Started (Authoring AWS Lambda Code in Java) page, but am stuck as com.amazonaws.services.lambda.runtime pacakge seems to be missing

Here is the sample code:

package example;

import com.amazonaws.services.lambda.runtime.Context;      //package does not exist error
import com.amazonaws.services.lambda.runtime.LambdaLogger; // package does not exist error
import com.amazonaws.services.s3.AmazonS3;       // import works (not needed, I've put them in for testing import)
import com.amazonaws.services.s3.model.S3Object; // import works (not needed, I've put them in for testing import)

public class Hello {
    public String myHandler(int myCount, Context context) {
        LambdaLogger logger = context.getLogger();
        logger.log("received : " + myCount);
        return String.valueOf(myCount);
    }
}

I encounter the same error both in Netbeans and through command line (specifying the aws sdk thorugh -cp argument) from the first two imports of the code:

package com.amazonaws.services.lambda.runtime does not exist

Note importing other packages from the SDK works fine, as per third and fourth imports from the above code (the s3 imports which i put in just to test).

I am using version 1.10.2 (aws-java-sdk-1.10.2.zip) of the AWS Java SDK, downloaded from http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip

Any directions/suggestions would be much appreciated. Thanks!

Advertisement

Answer

Both of those classes are contained in the aws-lambda-java-core jar, which is distributed separately from the AWS SDK. You can download it from maven central at the link above if you’re not using maven/gradle/some other build system that can natively pull from maven central.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement