IVONA SpeechCloud Java SDK

时间:2015-12-12 22:56:22

标签: java maven amazon-web-services intellij-idea text-to-speech

我只是尝试实现IVONA SpeechCloud Java SDK(使用特定的示例文件 SampleIvonaSpeechCloudCreateSpeech.java ,它应该可以运行"原样") IntelliJ IDEA IDE,但不断收到有关无法加载的AWS凭证文件的错误。

这是它的样子: Screenshot from IntelliJ IDEA

下载IVONA SpeechCloud Java SDK并从具有Maven依赖关系的现有源创建新项目后,我使用我的个人accessKeysecretKey更新了 IvonaCredentials.properties 文件

我还使用以下代码更新了 pom.xml 文件中的<dependencies>字段:

<dependency>
    <groupId>com.ivona</groupId>
    <artifactId>ivona-speechcloud-sdk-java</artifactId>
    <version>1.0.0</version>
</dependency>

有人知道如何解决Unable to load AWS credentials from the /resources/IvonaCredentials.properties file on the classpath错误吗?

1 个答案:

答案 0 :(得分:0)

好吧,我在源文件中搞乱几个小时之后想出来了。您可以创建自己的Provider Class,您可以在其中将凭据作为String Parameters传递。

这是我的自定义凭据类“IvonaCredentials”

$('#my-select option')
.each(function(index) {
    $(this).text('someNewText').val('someNewValue');
});

这就是我打电话给我的课程

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;

public class IvonaCredentials implements AWSCredentialsProvider{

public IvonaCredentials(String mSecretKey, String mAccessKey) {
    super();
    this.mSecretKey = mSecretKey;
    this.mAccessKey = mAccessKey;
}

private String mSecretKey;
private String mAccessKey;

@Override
public AWSCredentials getCredentials() {
    AWSCredentials awsCredentials = new AWSCredentials() {

        @Override
        public String getAWSSecretKey() {
            // TODO Auto-generated method stub
            return mSecretKey;
        }

        @Override
        public String getAWSAccessKeyId() {
            // TODO Auto-generated method stub
            return mAccessKey;
        };
    };
    return awsCredentials;
}

@Override
public void refresh() {
    // TODO Auto-generated method stub

}



}