Create a Hello World web app for Azure App Service using Eclipse

Using open sourced Azure Toolkit for Eclipse plugin, creating and deploying a basic Hello World application to Azure App Service as a web app can be done in a few minutes.

Note

If you prefer using IntelliJ IDEA, check out our similar tutorial for IntelliJ.

If you don't have an Azure subscription, create a free account before you begin.

Don't forget to clean up the resources after you complete this tutorial. In that case, running this guide will not exceed your free account quota.

Prerequisites

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

Note

The Azure Toolkit for Eclipse page at the Eclipse Marketplace lists the builds that are compatible with the toolkit.

Installation and sign-in

  1. Drag the following button to your running Eclipse workspace to install the Azure Toolkit for Eclipse plugin (other installation options).

    Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

  2. To sign in to your Azure account, click Tools, then click Azure, and then click Sign In. Eclipse Menu for Azure Sign In

  3. In the Azure Sign In window, select Device Login, and then click Sign in (other sign-in options).

    The Azure Sign In window with device login selected

  4. Click Copy&Open in Azure Device Login dialog .

    The Azure Login Dialog window

  5. In the browser, paste your device code (which has been copied when you clicked Copy&Open in last step) and then click Next.

    The device login browser

  6. Finally, in the Select Subscriptions dialog box, select the subscriptions that you want to use, then click OK.

    The Select Subscriptions dialog box

Creating web app project

  1. Click File, click New, and then click Dynamic Web Project. (If you don't see Dynamic Web Project listed as an available project after clicking File and New, then do the following: click File, click New, click Project..., expand Web, click Dynamic Web Project, and click Next.)

    Creating a new Dynamic Web Project

  2. For purposes of this tutorial, name the project MyWebApp. Your screen will appear similar to the following:

    New Dynamic Web Project properties

  3. Click Finish.

  4. Within Eclipse's Project Explorer view, expand MyWebApp. Right-click WebContent, click New, and then click JSP File.

    Create new JSP file

  5. In the New JSP File dialog box, name the file index.jsp, keep the parent folder as MyWebApp/WebContent, and then click Next.

    New JSP File dialog box

  6. In the Select JSP Template dialog box, for purposes of this tutorial select New JSP File (html), and then click Finish.

    Select JSP template

  7. When your index.jsp file opens in Eclipse, 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>
    
  8. Save index.jsp.

Deploying web app to Azure

  1. Within Eclipse's Project Explorer view, right-click your project, choose Azure, and then choose Publish as Azure Web App.

    Publish as Azure Web App

  2. When the Deploy Web App dialog box appears, you can choose one of the following options:

    • Select an existing web app if one exists.

      Select app service

    • Click Create New Web App.

      Create App Service

      Specify the requisite information for your web app in the Create App Service dialog box, and then click Create.

      Here you can configure the runtime environment, app settings, service plan and resource group.

      Create App Service dialog box

  3. Select your web app and then click Deploy.

    Deploy app service

  4. The toolkit will display a Published status under the Azure Activity Log tab when it has successfully deployed your web app, which is a hyperlink for the URL of your deployed web app.

    Publish status

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

    Browsing your web app

Displaying the Azure Explorer view

If the Azure Explorer view is not visible in Eclipse, display it by doing the following:

  1. Click Window, click Show View, and then click Other.

    Show View command

  2. In the Show View dialog box, select Azure Explorer, and then click OK.

    Show View dialog box

Cleaning up resources

  1. After you have published your web app to Azure, you can manage it by right-clicking in Azure Explorer and selecting one of the options in the context menu. For example, you can Delete your web app here to clean up the resource for this tutorial.

    Manage app service

Next steps

To report bugs or request new features, create issues on our GitHub repository. Or, ask questions on Stack Overflow with tag azure-java-tools.

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.