Microsoft Azure Websites WebJob in Java

Support for Java was recently added to Microsoft Azure Web Sites, and we can now provision and deploy our Java web sites here.  Fantastic!  Now enter WebJobs for running background tasks in Microsoft Azure Web Sites.  There are some great posts, documentation, and samples for WebJobs implemented in .NET or using one of the other script types for creating a runnable WebJob in this list.

  • .exe – .NET assemblies compiled with the WebJobs SDK
  • .cmd, .bat, .exe (using windows cmd)
  • .ps1 (using powershell)
  • .sh (using bash)
  • .php (using php)
  • .py (using python)
  • .js (using node)

Did you know you can run a Java WebJob in Microsoft Azure Web Sites?  We have a JRE available to us on the platform, and we can use one of the acceptable scripts to run it.  You should note that at the time of this writing Java WebJobs may not necessarily supported, but then again the feature is still in Preview.

Create a simple Hello Azure WebJob in Java, starting with a VERY basic console application.

Microsoft Azure Web Site WebJob Java Console Application Code Snippet

Then we create a script in one of the supported runnable web job script formats to launch our Java WebJob

Microsoft Azure WebJob Script to launch Java WebJob

Package it (Add them to .zip file)

Zip Java WebJob

Upload it to our Microsoft Azure Web Site

Upload Basic WebJob Settings

Run It

Azure Java WebJob


Successfully ran Azure Java WebJob

View WebJob Run Details

Azure Java WebJob Detailed Log Output

This is a very simple example of running a Java WebJob on Microsoft Azure WebSites and does not cover many of the details.  You should note that this may not necessarily be supported today.  For more information on Microsoft Azure Web Site WebJobs have a look at the Azure documentation on the subject.

Leave a Reply