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.
If you prefer using IntelliJ IDEA, check out our similar tutorial for IntelliJ.
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.
To complete the steps in this article, you will need to install the Azure Toolkit for Eclipse, which requires the following software components:
The Azure Toolkit for Eclipse page at the Eclipse Marketplace lists the builds that are compatible with the toolkit.
Installation and sign-in
Drag the following button to your running Eclipse workspace to install the Azure Toolkit for Eclipse plugin (other installation options).
To sign in to your Azure account, click Tools, then click Azure, and then click Sign In.
In the Azure Sign In window, select Device Login, and then click Sign in (other sign-in options).
Click Copy&Open in Azure Device Login dialog .
In the browser, paste your device code (which has been copied when you clicked Copy&Open in last step) and then click Next.
Finally, in the Select Subscriptions dialog box, select the subscriptions that you want to use, then click OK.
Creating web app project
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.)
For purposes of this tutorial, name the project MyWebApp. Your screen will appear similar to the following:
Within Eclipse's Project Explorer view, expand MyWebApp. Right-click WebContent, click New, and then click JSP File.
In the New JSP File dialog box, name the file index.jsp, keep the parent folder as MyWebApp/WebContent, and then click Next.
In the Select JSP Template dialog box, for purposes of this tutorial select New JSP File (html), and then click Finish.
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>
Deploying web app to Azure
Within Eclipse's Project Explorer view, right-click your project, choose Azure, and then choose Publish as Azure Web App.
When the Deploy Web App dialog box appears, you can choose one of the following options:
Select an existing web app if one exists.
Click Create New Web App.
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.
Select your web app and then click Deploy.
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.
You can browse to your web app using the link provided in the status message.
Displaying the Azure Explorer view
If the Azure Explorer view is not visible in Eclipse, display it by doing the following:
Click Window, click Show View, and then click Other.
In the Show View dialog box, select Azure Explorer, and then click OK.
Cleaning up resources
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.
For more information about using Java with Azure, see the following links:
- Azure for Java Developers
- Java with Azure DevOps Services
- Get Java JDK downloads and support when developing for Azure
For additional information about creating Azure Web Apps, see the Web Apps Overview.