You are here
Home > Java > How to Setup Google App Engine Server in NetBeans IDE

How to Setup Google App Engine Server in NetBeans IDE

Hello Friends Today I am going to explain how to setup Google App Engine Server in Netbeans IDE and deploy your application on Google App Engine.

So Before you start you need

  • Java 7 or latest version is Installed and JAVA_HOME environment variable is set
  • Apache Maven is installed and path environment variable is set to bin folder of apache maven
  • Basic knowledge of command line/terminal

Now follow the steps

  1. Register for a Google Developer account

    You can skip this step if you already registered or you can register from https://developers.google.com/
    Once you have successfully registered you gain access to the Google Development Console or Google Cloud Platform Console which will let you manage your application once it is deployed and other cloud resources.

  2. Create a Project on Google Cloud Platform

    Create a new project in the Google Cloud Platform Console. Click the Create Project button and enter a project name. Each project has a unique project ID which will either be the same as your project’s name or a slightly different ID will be suggested. This is because the project ID must be globally unique and someone is already using that ID. Once you have clicked Create you will receive notifications on the browser to confirm your project was created. This will create your application’s host location e.g. yourprojectid.appspot.com

    GCP Project Create

  3. Download Google App Engine SDK

    You can download the SDK here. You have to make sure you get the Java version as the page shows multiple. Once it has been downloaded, extract the zip from your downloads folder and save the extracted folder in your home directory of linux computer or any of your desired location. e.g. /home/LINUX_USERNAME/appengine-java-sdk-1.9.55

  4. Download Google App Engine Netbeans Plugin

    This plugin will allow you to create and run a Google App Engine Server instance which is what we will use to deploy your applications to the Google Cloud Platform. You can download the latest version here. Gaelyk carried on development of the plugin after Kenai created it but stopped development back in 2009. Make sure you download the most recent update. Again extract the download and place in the home directory or wherever you want.

  5. Add Plugin to Netbeans

    In your NetBeans IDE go to Tools menu and click the Plugins option. In the Plugins window go to the Downloads tab and click Add Plugins. Navigate to where you saved the plugin and open all of the NetBeans Modules (.nbm). Click Install at the bottom left of the plugins window and an Installation Wizard will pop up. Accept the Licence Agreement and install the modules.

    App Engine Netbeans Plugin.png

  6. Create Google App Engine Server Instance

    Go to your Services window, right click on Servers and select the Add Server option. In the wizard select Google App Engine and click Next. For the installation location put in the location of the SDK in the home directory or wherever you put the pasted the sdk. e.g. \home\LINUX_USERNAME\appengine-java-sdk-1.9.26. You can leave the port numbers for now and change them later if need be. Click Finish. You should now have Google App Instance under Servers.

  7. Google App Engine Project

    Now we can create a new Web Application. Go to the File menu and select New Project. In the Java Web category select Web Application. Fill in the name and location details for your project. On the Server and Settings screen select Google App Engine for the server. Java EE 5 is the only option for the Java EE version. Now click Finish and your project will be created.Google App Engine Project

  8. Change Project ID

    Below shows what your project’s file structure should resemble. To correctly deploy your application to the Google Cloud Platform you need to add your project Id to the appengine-web.xml file. Remember to save the file.Change Project ID

  9. Prepare Project for Deployment

    Right click the project and there should be a Change email/password option. Here you should enter your Google Development Account credentials. Then right click the project again and select Clean and Build which will compile the application for you.

  10. First Time Deployment

    This stage is needed for the very first deployment to Google App Engine. After you have completed this stage you will never have to carry this out for ANY other GAE project. here linux is used so terminal will be used. The commands will vary slightly for those on different Operating Systems.

    Navigate to your Google App Engine SDK directory. Then use cd bin to navigate you in the SDK’s bin directory. From there you will need to run appcfg.sh with the update argument and the path to your applications web directory e.g. ./appcfg.sh update /home/LINUX_USERNAME/NetBeansProjects/AppEngineApp1/web

    DeployingYou should be asked for an authentication code. A web browser will be opened  and you will be asked to sign in to your google account if you are not signed in already. After that there will be a code displayed which you need to copy from your browser into the command line. You should see output similar to above if your application has been deployed correctly.

    Note: This step will done only ones, later You can simply right click your project in NetBeans and select the Deploy to Google App Engine option but if you change username or password or want to change GCP account then you have to revalidate but you have to delete .appcfg_oauth2_tokens_java file to revalidate which is available in home directory and which is hidden by default.

  11. View Your Application

    To see your application running go to yourprojectid.appspot.com

Reference: https://blog.idrsolutions.com/2015/09/how-to-use-the-google-app-engine-with-the-netbeans-ide

Thank you
Please share if you like it and if you have any question you can ask in comment section

 

Rajesh Kumar Sahanee
I am a passionate Java Developer and I like Computer Programming. I love to do some interesting experiments and listening music in my free time.
http://www.zatackcoder.com

Comments

zatackcoder
Top