Create Java Based Web App in Azure using Eclipse IDE
We discussed creating a web app on Azure using Visual Studio here. In this Blog, we’ll elaborate the details of creating a Java-based Web App through Eclipse development Platform.
Create Web Apps in Azure using Eclipse
In this tutorial, let’s create sample Java web app in Eclipse and publish it to Azure.
- Java Developer Kit (JDK), version 1.8 or later.
- Apache Tomcat server
- Active/Trial Azure Subscription
- Eclipse Neon or higher (We’ve used Eclipse Oxygen for this tutorial)
- Azure Toolkit installation
- Start Eclipse
- Click Help -> Install new Software…
- In “Available Software” window, within “Work with” textbox copy this URL: http://dl.microsoft.com/eclipse/
- In Name pane, select only “Azure Toolkit for Java”, also uncheck “Contact all update sites during install to find required software” at the bottom. Click Next
- In “Install details dialogue” click Next.
- Accept terms of License Agreements and click Finish.
- Eclipse will download and install all required packages. Restart Eclipse once installation is complete.
- Create Sample Java Project in Eclipse
- Click File -> New -> Project. Select Dynamic Web Project.
- In Project Name, provide project name as AzureSampleApp.
- In Project Explorer, expand newly created AzureSampleApp and inside WebContent folder add index.jsp file.
- Open index.jsp, and paste below snippet inside the existing <body> parameter and then save it.
<b><% out.println(“Azure web App”); %></b>
- Build the app and run it on local application server such as Tomcat. You could see the page like below
- Publish Application On Azure
- In Project Explorer, right-click the project and select Azure.
- Select Publish as Azure Web App
- On Azure Sign In page, select Interactive, where we will manually login using Azure Subscription credentials.
- After Sign In, you can see Your Subscriptions which are listed in the window. Select your appropriate subscription.
- In the Deploy Web App pane, click Create.
- In the Create App Service pane, enter the name for your Azure App. We are using the name as “azuresampleappdemp”.
- In-App Service Plan tab, select location and pricing tier as appropriate.
- In Resource Group tab, we are selecting existing Resource Group but you can anyways create a new one.
- And lastly in Java tab, select environment parameters such as Java version and Tomcat version.
- Click Create. Then Azure Toolkit displays progress and finally creates the web app in Azure Cloud.
- After creating, you can see the app in the Deploy Web App window along with its details. But wait, our app isn’t live yet.
- To make it go live we have to deploy the app.
- Before clicking Deploy, make sure you have selected Deploy to root If you don’t select it then your app will be deployed on https://azuresampleappdemo.azurewebsites.net/AzureSampleApp having the app name in URL path, but by selecting app with root level deployment, App URL would be https://azuresampleappdemo.azurewebsites.net
- You can see progress in the Azure Activity Log dialog box in Eclipse.
- Click Published after publishing gets completed. It will open the web application in the browser. Congratulations!! , you have successfully created and deployed Azure Web App from Eclipse
In this blog, we have gone through the steps of creating a Java-based Web App through Eclipse IDE. Stay tuned for our next blog, where we would be discussing ‘How to Managing and Monitoring the Web App on Azure.