package com.amazonaws.services.lambda.runtime 在 AWS java sdk 1.10.2 中不存在
2022-09-01 16:49:34
我正在尝试入门(在Java中编写AWS Lambda代码)页面中的Java代码示例,但卡住了,因为com.amazonaws.services.lambda.runtime pacakge似乎丢失了
下面是示例代码:
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 和命令行(指定 aws sdk thorugh -cp 参数)中都遇到了来自前两个代码导入的相同错误:
package com.amazonaws.services.lambda.runtime 不存在
请注意,从SDK导入其他包工作正常,因为从上面的代码中导入了第三个和第四个包(我只是为了测试而放入的s3导入)。
我使用的是 AWS Java 开发工具包的版本 1.10.2 (aws-java-sdk-1.10.2.zip),从 http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip 下载
任何指示/建议将不胜感激。谢谢!