Join Patrick Royal for an in-depth discussion in this video Setting up a Cloud account: Mac, part of Using Java to Program Google App Engine.
- View Offline
- In this video we're going to set up a Cloud account on a Mac. You can start by navigating to the URL shown, or you could simply go to the Google App Engine homepage and choose Sign Up for a Cloud account. You'll need to login with your Google account or create one if you don't already have an account. This will take you to the Developers Console where you can get all of the tools you need for your first project. There are six steps that you need to complete to get you your first project set up. First you need the name of your project. I'll just call it Example. You also need to select the language, which is Java.
Google App Engine provides some starter code to help you understand the formatting and see what your code will look like when it runs. By default the code is a simple "Hello World" program. The files that are listed in this code are files that you will need for any app, so we'll refer back to the framework in the future. Next we need to install the Software Development Kit. Choose the correct version for your Operating System, in this case Mac, and then run the command provided. We can run this by opening a terminal and just type in the command as it's written. So the command is going to be "curl https://sdk.cloud.google.com/ | bash".
It will ask you what directory you wish to extract it under, you can just leave this as the default and press Return. Next it will ask you if you wish to improve Google Cloud SDK by providing usage data and other statistics to Google. You can choose whether or not to do that by inputting a "Yes" or a "No", and then press Return again. Next you'll be asked to specify which programming language you're using, in our case it's going to be Java so put in a one and press Return. Now will install the App Engine SDK for you. There's no need to specify an RC file to update, so you can just press Return at this prompt.
Then it will ask you if wish to modify the profile to update your PATH, you should put in a "Yes" here because you want to be able to access this from your command line. It will also ask you if you want to modify your profile to enable bash completion, you should also put in "Yes" here. In order to enable the next command you will need to quit your terminal and restart it, now run the command "gcloud auth login". This is going to allow you to test to make sure that you've installed everything correctly and it will also set up your project by authorizing you with Google.
This should open up a standard Google login page in your browser. Login, you'll be asked to authorize the data access needed by the Google Cloud SDK. Clicking Accept will authorize your app. Next, it's useful to have software that will allow you to run and test your app locally rather than having to upload it to the cloud every time. If you don't already have the latest version of Java installed, you can install it here. Then you can download the sample program appengine-try-java.zip and unpack it.
Now we're going to install the latest version of Apache Maven. Apache Maven will enable some new commands in your command line that will allow you to set up your project using Google Apps. It has compatible versions for Windows and Mac, so make sure you get the correct version installed. You can click on the link here and then choose the most recent version, and then make sure you get the correct file from this list here. Go ahead and extract this file and make a note to where you extracted it to. Open up the terminal and then use"cd" to change your active directory to appengine-try-java, so this will be "cd downloads" and then "cd appengine-try-java".
Then run the command "export PATH=" and then give the path to your Apache Maven folder, in this case it will be "/Users/producer" which is the user name "/downloads/apache-maven-" followed by the version number which in this case is "3.2.2/bin:$PATH". This adds Maven to your command line PATH, allowing you to directly reference its functions from within the command line.
Once all of this is done you can finally build the app with the syntax "mvn package". If you get a screen telling you that the build was successful then you've done everything correctly. Now you can go back to the Google Developers Console, agree to their Terms and Conditions, and then create your new project. Once that is finished you have everything you need set up to start developing and deploying projects in the Google App Engine. In the next video we're going to talk about how you can efficiently create the actual source code for your projects.
- Setting up Google App Engine accounts on Windows and Mac
- Creating a Google App Engine project
- Building the back-end code
- Creating the user interface
- Storing data
- Creating modules
- Testing and debugging
- Enabling security and encryption
- Working with extensions