Using Cloud Client Libraries for Java in a Local Server

App Engine Java projects use the Cloud Client Libraries for Java to access resources and services exposed by Google Cloud APIs.

Most Google cloud services require an application to be authorized for access. A service account is a special Google account that belongs to a deployed application in a particular Google Cloud project instead of an individual end user. When running on App Engine, the Cloud Client Libraries for Java use the service account to call Google service APIs.

When you run the same application in the App Engine emulator on your local box, you need to specify the Google Cloud project and the service account.

Configuring access for a local server

To configure your local server to access the Cloud Client Libraries for Java:

  1. Select Run > Run Configurations.

  2. Either create a new App Engine Local Server run configuration, or select an existing one.

  3. Open the Cloud Platform tab.

    A dialog box to configure run configurations. A new run config
has been created for App Engine Local Server, and the
Google Cloud tab is open. A field exists for Account, Project, and Service
Key. A browse button is available to select the service key path. The Create
New Key, Revert, Apply, and Run buttons are shown but disabled.

  4. Select the Account you want to use, or add a new account.

  5. Select the Project associated with your application.

  6. Select Create New Key.

    Eclipse creates a new service key and displays the path in the Service key field.

    A dialog box to configure run configurations. A new run config
has been created for App Engine Local Server, and the Google Cloud
is open. A field exists for Account, Project, and Service Key. A browse
button is available to select the service key path. The Create New Key,
Revert, Apply, and Run buttons are shown. An account and project are
selected. The Service key field displays the path to the key file.

  7. Select Apply.

You can also select a service account key you have created in the API console and downloaded to your local file system as a JSON file.

What's next