Amazon web services AWS SDK说;配置文件不存在";即使凭证文件存在

Amazon web services AWS SDK说;配置文件不存在";即使凭证文件存在,amazon-web-services,java.nio.file,Amazon Web Services,Java.nio.file,AWS Java SDK抛出错误“配置文件“$credential\u path”不存在”,如果凭据路径包含任何隐藏文件夹,如“c:\\\\User\\\\\\\.AWS\\\\\credentials” 如何让它工作 AWS SDK检查文件是否存在 "Validate.validState(contentLocation.toFile().exists(), "Profile file '%s' does not exist.", contentLocation);" java.nio.fi

AWS Java SDK抛出错误
“配置文件“$credential\u path”不存在”
,如果凭据路径包含任何隐藏文件夹,如
“c:\\\\User\\\\\\\.AWS\\\\\credentials”

如何让它工作

AWS SDK检查文件是否存在

"Validate.validState(contentLocation.toFile().exists(), "Profile file '%s' does not exist.", contentLocation);"
java.nio.file
能否处理隐藏文件夹

我的aws sdk测试代码:

ProfileFile profile = ProfileFile.builder()                                          
        .content(Paths.get("C:\\Users\\XXX\\.aws\\credentials"))                                         
        .type(ProfileFile.Type.CREDENTIALS)
        .build();

它看起来像一个默认路径,然后我认为不需要设置路径。此外,隐藏的意思只是看不见,但您可以访问,所以这并不重要。我使用另一个路径进行测试,如“c:\\User\\.test\test.txt”,使用代码路径p=Paths.get(“c:\\User\\\.test\test.txt”);Validate.validState(p.toFile().exists(),“配置文件“%s”不存在。”,p);它还说文件不存在,但文件在那里。如果将凭证文件移动到C:\aws\credential并使用此路径,则可以正常工作。