我为java安装了AWS toolkit
并将其连接到buildpath中的项目,我尝试将文件上传到S3
。
File fileOfImages = new File("/sdcard/Save Image Tutorial");
AmazonS3 s3client = new AmazonS3Client(new ProfileCredentialsProvider());
s3client.putObject(new PutObjectRequest("rosh-haayin-images", "images",fileOfImages));
但我收到以下错误:
ClassNotFoundException: com.amazonaws.auth.AWSCredentialsProvider
有人可以解释为什么会发生此异常吗?
答案 0 :(得分:1)
这意味着您在项目构建路径中缺少aws-java-sdk-1.10.X.jar。
$ jar tvf /home/xxx/aws-java-sdk/1.10.52/lib/aws-java-sdk-1.10.52.jar |grep AWSCredentialsProvider
3485 Thu Feb 11 22:22:34 IST 2016 com/amazonaws/auth/AWSCredentialsProviderChain.class
233 Thu Feb 11 22:22:34 IST 2016 com/amazonaws/auth/AWSCredentialsProvider.class
806 Thu Feb 11 22:22:34 IST 2016 com/amazonaws/auth/DefaultAWSCredentialsProviderChain.class
验证您的项目是否引用(Java Build Path)到jar。