Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

Using this code for setting the classpath

AWSCredentialsProvider credentialsProvider = new ClasspathPropertiesFileCredentialsProvider();

ec2 = new AmazonEC2Client(credentialsProvider);

Below is the format for file

# Fill in your AWS Access Key ID and Secret Access Key


accessKey = key here

secretKey = secret key here

Below is the exception I am getting

Exception in thread "main" com.amazonaws.AmazonClientException: Unable to load AWS credentials from the / file on the classpath

    at com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider.getCredentials(


1 Answer

0 votes
by (44.4k points)

The reason for this exception is because your AWS SDK is not able to load your credentials. Now, do this:

Preference → AWS → Add Secret key and Access key

This will allow your project to retrieve both the keys.

Related questions

Want to get 50% Hike on your Salary?

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

Browse Categories