Create a Hello World web app for Azure using IntelliJ

This tutorial shows how to create and deploy a basic Hello World application to Azure as a web app by using the Azure Toolkit for IntelliJ.

Note

For a version of this article that uses the Azure Toolkit for Eclipse, see Create a Hello World web app for Azure using Eclipse.

Important

The Azure Toolkit for IntelliJ was updated in August 2017 with a different workflow. This article illustrates creating a Hello World web app by using version 3.0.7 (or later) of the Azure Toolkit for IntelliJ. If you are using the version 3.0.6 (or earlier) of the toolkit, you will need to follow the steps in Create a Hello World web app for Azure in IntelliJ using the legacy toolkit.

When you have completed this tutorial, your application will look similar to the following illustration when you view it in a web browser:

Preview of Hello World app

Prerequisites

To complete the steps in his article, you will need to install the Azure Toolkit for IntelliJ, which requires the following software components:

  • IntelliJ IDEA Ultimate Edition or Community Edition, which can be downloaded from the JetBrains website.

  • A supported Java Development Kit (JDK). For more information about the JDKs available for use when developing on Azure, see https://aka.ms/azure-jdks.

  • An operating system. The Azure Toolkit for IntelliJ has been tested on the following operating systems:

    • Windows 10, Windows 8.1, Windows 8, and Windows 7
    • Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2, and Windows Server 2008
    • Mac OS X version "Yosemite" and later
    • Ubuntu Linux version 14, 15, and 16

Note

The Azure Toolkit for IntelliJ page at the JetBrains Plugin Repository lists the builds that are compatible with the toolkit.

Create a new web app project

  1. Start IntelliJ, and sign into your Azure account by using the instructions in the Azure Sign In Instructions for the Azure Toolkit for IntelliJ article.

  2. Click the File menu, then click New, and then click Project.

    Create New Project

  3. In the New Project dialog box, select Maven, then maven-archetype-webapp, and then click Next.

    Choose Maven archetype webapp

  4. Specify the GroupId and ArtifactId for your web app, and then click Next.

    Specify GroupId and ArtifactId

  5. Customize any Maven settings or accept the defaults, and then click Next.

    Specify Maven settings

  6. Specify your project name and location, and then click Finish.

    Specify project name

  7. Within IntelliJ's Project Explorer view, expand src, then main, then webapp, and then double-click index.jsp.

    Open index page

  8. When your index.jsp file opens in IntelliJ, add in text to dynamically display Hello World! within the existing <body> element. Your updated <body> content should resemble the following example:

    <body><b><% out.println("Hello World!"); %></b></body>
    

    Edit index page

  9. Save index.jsp.

Deploy your web app to Azure

  1. Within IntelliJ's Project Explorer view, right-click your project, choose Azure, and then choose Run on Web App.

    Run on web app menu

  2. In the Run on Web App dialog box, you can choose one of the following options:

    • Choose an existing web app (if one exists), and then click Run.

      Run on Web App dialog box

    • Click Create New Web App. If you choose to create a new web app, specify the requisite information for your web app, and then click Run.

      Create new web app

  3. The toolkit will display a status message when it has successfully deployed your web app, which will also display the URL of your deployed web app.

    Successful deployment

  4. You can browse to your web app using the link provided in the status message.

    Browsing your web app

  5. After you have published your web app, your settings will be saved as the default, and you can run your application on Azure by clicking the green arrow icon on the toolbar. You can modify your settings by clicking the drop-down menu for your web app and click Edit Configurations.

    Edit configuration menu

  6. When the Run/Debug Configurations dialog box is displayed, you can modify any of the default settings, and then click OK.

    Edit configuration dialog box

Next steps

For more information about the Azure Toolkit for IntelliJ IDEA, see the following links:

For more information about using Java with Azure, see the following links:

For additional information about creating Azure Web Apps, see the Web Apps Overview.