Create your first Java web app in Azure

Azure App Service provides a highly scalable, self-patching web hosting service. This quickstart shows how to deploy a Java web app to App Service by using the Eclipse IDE for Java EE Developers.


Azure App Service on Linux is also an option to host Java web apps natively on Linux using managed Tomcat, Java SE, and WildFly offerings. If you're interested in getting started with App Service on Linux, see Quickstart: Create a Java app in App Service on Linux.

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

"Hello Azure!" example web app

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


The steps in this quickstart show how to use the Eclipse IDE to publish a Java web app to App Service, but you can use the IntelliJ IDEA Ultimate Edition or Community Edition. For more information, see Create a Hello World web app for Azure using IntelliJ.


To complete this quickstart, install:


You will need to sign into your Azure account using the Azure Toolkit for Eclipse to complete the steps in this quickstart. To do so, see Azure Sign In Instructions for the Azure Toolkit for Eclipse.

Create a dynamic web project in Eclipse

In Eclipse, select File > New > Dynamic Web Project.

In the New Dynamic Web Project dialog box, name the project MyFirstJavaOnAzureWebApp, and select Finish.

New Dynamic Web Project dialog box

Add a JSP page

If Project Explorer is not displayed, restore it.

Java EE workspace for Eclipse

In Project Explorer, expand the MyFirstJavaOnAzureWebApp project. Right-click WebContent, and then select New > JSP File.

Menu for a new JSP file in Project Explorer

In the New JSP File dialog box:

  • Name the file index.jsp.

  • Select Finish.

    New JSP File dialog box

In the index.jsp file, replace the <body></body> element with the following markup:

<h1><% out.println("Hello Azure!"); %></h1>

Save the changes.


If you see an error on line 1 that refers to a missing Java Servlet class, you can ignore it.

Benign Java servlet error

Publish the web app to Azure

In Project Explorer, right-click your project, and then select Azure > Publish as Azure Web App.

Publish as Azure Web App context menu

If you are prompted with the Azure Sign In dialog box, you will need to follow the steps in the Azure Sign In Instructions for the Azure Toolkit for Eclipse article to enter your credentials.

Deploy Web App dialog box

After you have signed in to your Azure account, the Deploy Web App dialog box appears.

Select Create.

Deploy Web App dialog box

Create App Service dialog box

The Create App Service dialog box appears with default values. The number 170602185241 shown in the following image is different in your dialog box.

Create App Service dialog box

In the Create App Service dialog box:

  • Enter a unique name for your web app, or keep the generated name. This name must be unique across Azure. The name is part of the URL address for the web app. For example: if the web app name is MyJavaWebApp, the URL is

  • For this quickstart, keep the default web container.

  • Select an Azure subscription.

  • On the App service plan tab:

    • Create new: Keep the default, which is the name of the App Service plan.

    • Location: Select West Europe or a location near you.

    • Pricing tier: Select the free option. For features, see App Service pricing.

      Create App Service dialog box

An App Service plan specifies the location, size, and features of the web server farm that hosts your app. You can save money when hosting multiple apps by configuring the web apps to share a single App Service plan.

App Service plans define:

  • Region (for example: North Europe, East US, or Southeast Asia)
  • Instance size (small, medium, or large)
  • Scale count (1 to 20 instances)
  • SKU (Free, Shared, Basic, Standard, or Premium)

Resource group tab

Select the Resource group tab. Keep the default generated value for the resource group.

Resource group tab

A resource group is a logical container into which Azure resources like web apps, databases, and storage accounts are deployed and managed. For example, you can choose to delete the entire resource group in one simple step later.

Select Create.

The Azure Toolkit creates the web app and displays a progress dialog box.

Create App Service Progress dialog box

Deploy Web App dialog box

In the Deploy Web App dialog box, select Deploy to root. If you have an app service at and you do not deploy to the root, the web app named MyFirstJavaOnAzureWebApp is deployed to

Deploy Web App dialog box

The dialog box shows the Azure, JDK, and web container selections.

Select Deploy to publish the web app to Azure.

When the publishing finishes, select the Published link in the Azure Activity Log dialog box.

Azure Activity Log dialog box

Congratulations! You have successfully deployed your web app to Azure.

"Hello Azure!" example web app

Update the web app

Change the sample JSP code to a different message.

<h1><% out.println("Hello again Azure!"); %></h1>

Save the changes.

In Project Explorer, right-click the project, and then select Azure > Publish as Azure Web App.

The Deploy Web App dialog box appears and shows the app service that you previously created.


Select Deploy to root each time you publish.

Select the web app and select Deploy, which publishes the changes.

When the Publishing link appears, select it to browse to the web app and see the changes.

Manage the web app

Go to the Azure portal to see the web app that you created.

From the left menu, select Resource Groups.

Portal navigation to resource groups

Select the resource group. The page shows the resources that you created in this quickstart.

Resource group

Select the web app (webapp-170602193915 in the preceding image).

The Overview page appears. This page gives you a view of how the app is doing. Here, you can perform basic management tasks like browse, stop, start, restart, and delete. The tabs on the left side of the page show the different configurations that you can open.

App Service page in Azure portal

Clean up resources

In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these resources in the future, you can delete them by deleting the resource group.

  1. From your web app's Overview page in the Azure portal, select the myResourceGroup link under Resource group.
  2. On the resource group page, make sure that the listed resources are the ones you want to delete.
  3. Select Delete, type myResourceGroup in the text box, and then select Delete.

Next steps