以下是示例代码:
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);
}
}
我在Netbeans和命令行中(通过-cp参数指定aws sdk)从代码的前两个导入中遇到了相同的错误:
包com.amazonaws.services.lambda.runtime不存在
请注意,从SDK导入其他软件包正常工作,如上面代码中的第三个和第四个导入的S3软件包(我只是为了测试而添加的)。
我正在使用AWS Java SDK的版本1.10.2(aws-java-sdk-1.10.2.zip),从http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip下载。
任何指示/建议将不胜感激。谢谢!