diff --git a/compute/sendgrid/README.md b/compute/sendgrid/README.md index 7a9c16aa53c..00b2281d2da 100644 --- a/compute/sendgrid/README.md +++ b/compute/sendgrid/README.md @@ -11,7 +11,7 @@ For more information about SendGrid, see their [sample-docs]: https://cloud.google.com/compute/docs/tutorials/sending-mail/using-sendgrid -## Running on Compute Engine +## Running on Compute Engine To run the sample, you will need to do the following: @@ -20,17 +20,30 @@ To run the sample, you will need to do the following: 1. Create a compute instance on the Google Cloud Platform Developer's Console 1. SSH into the instance you created 1. Update packages and install required packages - sudo apt-get update && sudo apt-get install git-core openjdk-8-jdk maven + + sudo apt-get update && sudo apt-get install git-core openjdk-8-jdk maven + 1. Clone the repo - git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git -1. Configure your SendGrid settings in the java class (SENDGRID_API_KEY, SENDGRID_SENDER, TO_EMAIL) - java-docs-samples/compute/sendgrid/src/main/java/com/example/compute/sendgrid/SendEmailServlet.java -1. Navigate back to ./sendgrid and use maven to package the class as a jar - mvn clean package + + git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git + +1. Configure your SendGrid settings in the java class (`SENDGRID_API_KEY`, + `SENDGRID_SENDER`, `TO_EMAIL`) + + java-docs-samples/compute/sendgrid/src/main/java/com/example/compute/sendgrid/SendEmailServlet.java + +1. Navigate back to `./sendgrid` and use maven to package the class as a jar + + mvn clean package + 1. Switch to the target directory with the jar file and enable execution on that file - chmod +x compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar + + chmod +x compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar + 1. Make sure that openjdk 8 is the selected java version - sudo update-alternatives --config java + + sudo update-alternatives --config java + 1. Execute the jar file and send an email (make sure you are in the target folder) - java -jar compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar + java -jar compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar