Published: 17 Feb 2012
By: Janani K

This article demonstrates how to install Windows Azure Plugin for Eclipse, create a Hello World application using this installed plugin, deploying and testing the application in Windows Azure cloud.

Contents [hide]

Introduction

This article demonstrates how to install Windows Azure Plugin for Eclipse, create a Hello World application using this installed plugin, deploying and testing the application in Windows Azure cloud. Also we are going to see how to use the Azure Management portal to manage the deployed application in the Azure environment.

We are going to split this article into 2 part series, in the first part we are going to see how to install the Windows Azure Plugin for Eclipse and see how to create the application. In our second part we will see how to deploy the Java application developed in Eclipse to the Windows Azure Management Portal using the Hosted Services. Let us see the step by step process on how to achieve these tasks in the below explanations.

Overview

Windows Azure, a Platform as a service (one of the cloud Terminology), is a service based operating system which provides the end users to build, deploy and host the application to the Microsoft Infrastructures at a nominal fees based on the usage. Windows Azure is an open platform which not only hosts the Microsoft languages but also used to host the Non-Microsoft Languages. Windows Azure provides the end users with on-demand compute & storage to host, scale, and manage web applications and services on the internet in Microsoft data centres.

The Windows Azure Plugin for Eclipse with Java helps users in creating, testing and deploying Java applications for the Windows Azure Cloud. It includes windows azure project creation wizard, sample utility scripts that logs errors in start-up scripts when running in the cloud, shortcuts to test the deployed application in the cloud using windows azure compute emulator.

Install Windows Azure Plugin for Eclipse with Java

To install Windows Azure plugin for eclipse ensure you have Java Developer Kit v1.6 or later, Eclipse IDE for Java EE developers and Windows Azure SDK installed in your system.

If you do not have Windows Azure SDK installed, you can download it using the Web Platform Installer (WebPI) at http://www.microsoft.com/web/gallery/install.aspx?appid=WindowsAzureSDK.

Steps to Install Windows Azure Plugin for Eclipse with Java

Open Eclipse application. Click on Help -> Install New Software as shown in the screen below.

In the Work With text box of the Available Software dialog that pops up, type http://dl.windowsazure.com/eclipse and press enter key. You should see a screen as shown below.

Expand Windows Azure Toolkit for Java in the Name pane. You should see the following items

  • Windows Azure Plugin for Eclipse with Java: Contains project configuration logic and user interface.
  • Microsoft JDBC Driver 3.0 for SQL Server: Simplifies application development using SQL Azure.

Check "Windows Azure Toolkit for Java" and click on Next as shown in the screen below.

Click on the Next button in the Install Details dialog as shown in the screen below.

Review the Microsoft software terms in the Review Licenses dialog that appears. Click on I accept the terms of the license agreement if you accept the terms on the license agreement and then click on Finish button.

This might prompt you to restart eclipse for the installation changes to take effect. Click on Restart now for the changes to take effect.

The Windows Azure Plugin for Eclipse should be installed successfully now.

NOTE

If you already have a previous version of this plugin installed, uninstall it before installing this latest version. Eclipse's automatic software upgrade will not work since the latest version is present in a different location from its previous version.

Creating Hello World Application using the Windows Azure plugin for Eclipse

To get started with this tutorial, you will need to install the Windows Azure plugin for Eclipse and any Java based webserver or application server such as Apache Tomcat/ Glass Fish/ JBoss. You will also need a Windows Azure subscription which can be got from http://www.microsoft.com/windowsazure/offers/.

In this tutorial we will see how to create and deploy a simple JSP application to Windows Azure using the Windows Azure plugin for Eclipse with Java. Though this example might look simple, highly similar steps would be followed to deploy any Java application to Windows Azure cloud.

Steps to create a Hello World Application

Open Eclipse Application. Click on File -> New -> Dynamic Web Project as shown in the screen below.

If you do not get the Dynamic Web Project option under New in the menu, then click on File -> New -> Other. Select a Wizard dialog appears. Select Dynamic Web Project option under Web and click on Next as shown in the screen below.

Enter project name as HelloWorld in the Project Name text box and click on Finish button as shown in the screen below.

Expand HelloWorld in the Project Explorer. Right click on WebContent and click on New -> JSP File as shown in the screen below.

Specify File Name as index.jsp in the New JSP dialog and click on Next button as shown in the screen below.

In Select JSP Template dialog, select the template as New JSP File (html) and click on Finish Button as shown in the screen below.

index.jsp file opens up in eclipse. Update body content as shown below and save the jsp.

Next step is to create a Windows Azure Project. In Eclipse, click on File -> New -> Other as shown in screen below.

In the dialog that appears, expand Windows Azure project and select Windows Azure project and click on Next button as shown in screen below.

Specify Project Name as HelloWorldAzureProject. Change the default location of the project if needed, but make a note of it since that's where the WAR file will be created. Accept default values for WorkerRole1 under Roles and click on Finish as shown in the screen below.

Here before proceeding let us see what Worker Role is. In Windows Azure we have 3 different types of Roles.

  • Web Role
  • Worker Role
  • VM Role

Web Role is used to run our customized web application on to an IIS 7 webserver on the virtual machine of the Windows Azure infrastructure. This role is normally used when the requirement is for using the web application with ASP.NET in the azure environment.

Worker Role is used to perform the background operation for any of the application that we are going to deploy in the Virtual machine. In general we can compare this with the Windows Service which runs in the server and the resources are utilized based on the need. Similarly we use the Worker Role in the Azure development environment to make some general background development like data transfers, processing daily feeds etc.

Now we need to create a .WAR file for our HelloWorld project. In the project explorer of eclipse, right click on HelloWorld project and click on Export -> WAR File as shown in the screen below.

In the Export dialog that appears, click on the Browse button next to the Destination text box. Browse the path in which the .WAR file needs to be saved. This path needs to be

<your windows azure project location>\HelloWorldAzureProject\WorkerRole1\approot

Also check Overwrite existing File check box since a default HelloWorld.war will be shipped with the Azure project.

With all these the Export dialog looks as shown in the screen below.

Click on Finish button.

From the project explorer in eclipse, ensure HelloWorld.war is present under HelloWorldAzureProject -> WorkerRole1 -> approot

You can also confirm if the HelloWorld.war is the latest or if that's the one you created, by right clicking on the HelloWorld.war and clicking on Properties as shown in the screen below.

Properties of this war pop up in a dialog. You can verify the date in which the HelloWorld.war was created as shown in the screen below.

Conclusion

In this article we have seen what windows azure is and how to install the windows azure plugin for eclipse. We also saw the steps involved in creating a simple Hello World java application and an azure project using the installed Windows Azure plugin. Steps for exporting the WAR file of the java application and placing it in the Azure project is also explained. In the Part II series of this article, we will see the steps involved in building the azure project, deploying it to the compute emulator and finally deploying the HelloWorld application to the Windows Azure platform. Also we will see how to use the Windows Azure portal to manage the deployed application.

<<  Previous Article Continue reading and see our next or previous articles Next Article >>

About Janani K

Sorry, no bio is available

This author has published 2 articles on DotNetSlackers. View other articles or the complete profile here.

Other articles in this category


Android for .NET Developers - Location and Maps
In Windows Phone and iOS getting the current position of the device in terms of latitude and longitu...
Android for .NET Developers - Using Web Views
In this article, I'll show a native app that contains a web-based view. The great news is that HTML ...
Android for .NET Developers - Building a Twitter Client
In this article, I'll discuss the features and capabilities required by an Android application to ta...
Developing a Hello World Java Application and Deploying it in Windows Azure - Part II
In this article we will see the steps involved in deploying the WAR created in the first part of thi...
Ref and Out (The Inside Story)
Knowing the power of ref and out, a developer will certainly make full use of this feature of parame...

You might also be interested in the following related blog posts


Updated SilverTwit Code for MSDN Magazine read more
Update on Silverstripe and the WebPI read more
Provisioning a UCMA application using ApplicationProvisioner.exe read more
Windows Azure How Do I videos for developers recently released read more
Introduction to HealthVault Development #2: Hello World read more
Modularization Status Update read more
Silverlight 2 Essential Getting Started Facts and Guide read more
The Ajax Papers: Part III read more
Host WPF Controls in Windows Forms read more
AJAX-enabled Vista Sidebar Gadgets read more
Top
 
 
 

Please login to rate or to leave a comment.