I have Google Compute Engine\'s Credentials file , renamed as key.json. The next step is to set the environment variable with name GOOGLE_APPLICATION_CREDENTIALS. But it say
If you are using a tomcat (although this is valid in any case), you have to search for "launch configuration", in the "environment" tab you can add the variable and its value. In the image you can see that I accessed "launch configuration" from the tomcat overview.
Another option is to use GoogleCredentials.fromStream ("path_to_json") to set the credentials, depending on which api is used where it can be used.
You got the error because you downloaded an OAuth 2.0 Client ID instead of a Service Account key.
If you want to use regular user credentials as the application default, you can now use the gcloud beta auth application-default login command to launch the web sign-in flow. This puts them in the well-known location for application default credentials, so you should unset the GOOGLE_APPLICATION_CREDENTIALS variable if you use this method.
This question is satisfiable by a reading of the documentation. As of Mar. 15, 2016:
The environment variable GOOGLE_APPLICATION_CREDENTIALS is checked. If this variable is specified it should point to a file that defines the credentials.
The documentation explains more about how you can create such a file.
As to how to set this in eclipse, it's an environment variable, and you should search the Eclipse documentation to see how to set environment variables for tasks you want to run.