Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (5.6k points)

I have installed AWS toolkit for java and then connected it to the project in the build path, and now I'm trying to upload file to S3

File fileOfImages = new File("/sdcard/Save Image Tutorial");

AmazonS3 s3client = new AmazonS3Client(new ProfileCredentialsProvider());        

s3client.putObject(new PutObjectRequest("rosh-haayin-images", "images",fileOfImages)); 

But it fails and I'm getting the below error:

ClassNotFoundException: com.amazonaws.auth.AWSCredentialsProvider

Can someone help me with the solution?

1 Answer

0 votes
by (12.4k points)

I think you are missing aws-java-sdk-1.10.x.jar in the project build path, so get it and then verify that project refers Java Build path to the 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

Want to become AWS Expert? Come & join AWS Certification.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...