I tried to use Google Speach Api
and I have big problem with authentication.
I followed this tutorial, and I export GOOGLE_APPLICATION_CREDENTIALS, and I checked it using echo, and all ok.
But when I start code from first link I get error:
Exception in thread "main" java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:119)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:127)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:100)
at com.google.api.gax.core.GoogleCredentialsProvider.getCredentials(GoogleCredentialsProvider.java:53)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:110)
at com.google.cloud.speech.v1.stub.GrpcSpeechStub.create(GrpcSpeechStub.java:93)
at com.google.cloud.speech.v1.SpeechSettings.createStub(SpeechSettings.java:128)
at com.google.cloud.speech.v1.SpeechClient.<init>(SpeechClient.java:143)
at com.google.cloud.speech.v1.SpeechClient.create(SpeechClient.java:125)
at com.google.cloud.speech.v1.SpeechClient.create(SpeechClient.java:117)
at com.example.speech.QuickstartSample.main(QuickstartSample.java:58)
Of course I checked path in environment variable, even I get this file chmod 777, and nothing help.
anyone have similar problem?
My output for stat $GOOGLE_APPLICATION_CREDENTIALS
:
File: /home/kruczek/Pulpit/mirthconnection-59cb32bcd531.json
Size: 2329 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 2360629 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 1000/ kruczek) Gid: ( 1000/ kruczek)
Access: 2017-12-01 14:20:33.111439885 +0100
Modify: 2017-12-01 14:20:33.111439885 +0100
Change: 2017-12-01 15:24:26.476545027 +0100
Birth: -
but when i restart computer and i call stat
, i have stat: missing operand
my export commend export GOOGLE_APPLICATION_CREDENTIALS=/home/kruczek/Pulpit/mirthconnection-59cb32bcd531.json
and I run project by IDE Intellij, next to privat static void main
we have green arrow to run method.
In eclipse, Run -> Run Configurations.. -> Environment tab
Enter GOOGLE_APPLICATION_CREDENTIALS under Name: Enter json path in Value:
Make sure you have not entered with quotes when enter path in Value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With