blog.smarx.com

Steve Marx's blog about cloud development

Does Windows Azure Support Java?

Recently I’ve been struggling to answer a simple question: “Does Windows Azure support Java?”  In this blog post, I’ll explain why I don’t consider us as having Java support in Windows Azure today.  Then I’ll show you a limited scenario (with a sample) in which you can run Java code in the cloud.

For some background, the question is coming up recently because Google just announced a preview of their Java support.  For an answer about Java support across the entire Azure Services Platform, I recommend reading Mary Jo Foley’s recent article “What is Microsoft doing to add Java support to Azure?”

Windows Azure doesn’t support Java today

Most people asking the question of whether we support Java are asking because they have an existing investment in Java, and they’d like to run that in our cloud to get the benefits of Windows Azure.  That existing investment is usually in the form of Java servlets, JSP, J2EE, etc., and is usually heavily tied to Tomcat, Jetty, or another web server technology.

The Windows Azure web role currently doesn’t support any of the popular ways of hosting Java servlets, so my first answer to the question is “No, Windows azure doesn’t support Java today.”

But, you can run whatever you want

Since MIX, when we announced .NET Full Trust and native code support, you can launch whatever code you want.  If it can run on Windows without admin privilege and without install (copy-deploy only), it will probably work in Windows Azure.

It so happens that the Java Runtime Environment (JRE) can be copy-deployed, which means you can just invoke java.exe.  You could do this from a web role, but I would caution against using it as a way of responding to web requests, because starting a process on each web request is pretty inefficient.  However, in the worker role, invoking an executable is perfectly reasonable.

The worker role in Windows Azure is a very simple pattern.  You write a .NET assembly with a Start method, which never returns.  To run Java code instead, you just need to write a .NET assembly which invokes java.exe from that Start method.

From that Java code, you can do whatever you want, but typically you’ll want to poll a Windows Azure queue and maybe write results back to storage.  Because Windows Azure storage is based on HTTP and XML, it’s not too hard to write Java code to interact with storage.

Shoutomatic

In my next blog post, I’ll dive into a sample I wrote over the past few days called Shoutomatic that uses the technique described above.  You can try it now at http://shout.cloudapp.net.  It uses PHP to display a form and post user input to a Windows Azure queue.  Java code running in my worker role than polls the queue, picks up incoming messages, and posts them to Twitter.

UPDATE: I’ve since posted the follow-up about Shoutomatic: “Programming Language Interoperability in Windows Azure


Comments

2009-12-05 17:41 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2009-12-15 05:15 GMT
Thank you for the sensible critique. Me & my neighbour were preparing to do some research about that. We got a good book on that matter from our local library and most books where not as influensive as your information. I am very glad to see such information which I was searching for a long time.This made very glad Smile
2009-12-25 02:32 GMT
It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this

kind of post. I will be your loyal reader. Thanks again.
2009-12-25 02:32 GMT
It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this
kind of post. I will be your loyal reader. Thanks again.
2009-12-25 02:32 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2009-12-25 02:32 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2009-12-25 02:35 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2009-12-25 02:35 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2009-12-25 02:35 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2010-01-01 06:57 GMT
Thank you for the sensible critique.
2010-01-04 14:14 GMT
Since MIX, when we announced .NET Full Trust and native code support, you can launch whatever code you want. If it can run on Windows without admin privilege and without install (copy-deploy only), it will probably work in Windows Azure.
2010-01-06 08:33 GMT
This may be a perfect example of information asymmetry and adverse selection in insurance. I hope all textbook authors and legislators notice.
2010-01-06 15:38 GMT
It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this
kind of post. I will be your loyal reader. Thanks again.
2010-01-06 17:04 GMT
I am very glad to see such information which I was searching for a long time.This made very glad Smile
2010-01-08 08:37 GMT
It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.
2010-01-08 08:38 GMT
It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.
2010-01-08 18:53 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2010-01-09 08:50 GMT
This may be a perfect example of information asymmetry and adverse selection in insurance. I hope all textbook authors and legislators notice.
2010-01-09 16:32 GMT
This release is the culmination our team’s year-long work with our partners for bringing core PDC09 scenarios to life and a release that many of our customers & open source developers have eagerly been waiting for since our last CTP release at Eclipse Summit Europe. I want to thank our engineering partners Real Dolmen & Soyatec who have done a great job in such a short period of time to complete SDKs & tooling.
2010-01-15 05:50 GMT
Nice information.I have recently lost my data due to virus attack.With the help of iyogi anti virus support able to recover my lost data.For more details visit
http://www.supportdock.com/anti-virus-powered-by-mcafee.html
2010-01-15 05:50 GMT
Nice information.I have recently lost my data due to virus attack.With the help of iyogi anti virus support able to recover my lost data.For more details visit
http://www.supportdock.com/anti-virus-powered-by-mcafee.html
2010-01-16 18:28 GMT
Since MIX, when we announced .NET Full Trust and native code support, you can launch whatever code you want. If it can run on Windows without admin privilege and without install (copy-deploy only), it will probably work in Windows Azure.
2010-01-21 06:26 GMT
I cannot belive the processing per hour cost is actually higher than the app engine (I understand there is a difference in platforms - but the processing is the biggest cost on the App Engine so I fully expect a lot of Azure customers to be suprised by their first bill from Microsoft)
2010-01-21 06:26 GMT
Tweval takes advantage of one of the coolest things about the MIX announcements we made earlier today, which is that Windows Azure can now run PHP (or indeed anything compatible with FastCGI). In fact, in Tweval, I’m running ASP.NET MVC code side-by-side with PHP code.
2010-01-21 06:26 GMT
This diagram shows PHP serving all the UI, but in actuality, both ASP.NET and PHP are rendering UI, as you can see at http://tweval.com/mix09-smarx and http://tweval.com/index.php?tag=mix09-smarx (note the bottom right corner of the page).
2010-01-21 06:27 GMT
One option that I saw recently is Maarten Balliauw’s PHP library. Currently it only supports blob storage, but he tel
2010-01-21 06:27 GMT
For tweval.com, I didn’t use a client library at all. I rolled my own function to perform the specific query I needed. Here’s the code I used:
2010-01-23 12:35 GMT
g Thank you for submitting this cool story - Trackback from Dotbot. et me know if you’re going to attend one of the events and what you’re hoping to learn.
2010-01-24 22:19 GMT
Thanks you admin.I like you web sites.
2010-01-25 09:37 GMT
Hi, I am grateful to you very much for this page prepared you, good day, I worked a lot of work. 
2010-01-25 17:14 GMT
This may be a perfect example of information asymmetry and adverse selection in insurance. I hope all textbook authors and legislators notice.
2010-01-27 18:37 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2010-01-30 11:17 GMT
Nice information here.
2010-01-30 11:17 GMT
Nice information here.
2010-01-30 11:18 GMT
Nice information here.
2010-02-01 13:24 GMT
thanks
2010-02-01 22:40 GMT
Extremely informative. I highly doubt they'll ever support Java b/c Microsoft is equally invested in the success of .NET.
2010-02-02 17:58 GMT
Very informative post. really helpful information have been posted. Thanks for sharing.
2010-02-02 18:15 GMT
Thanks you admin, i Love You.
2010-02-07 23:48 GMT
Thanks, help me to have good information, good work ..

Add a comment

Your name:
Your URL
(will be linked from your name):
Your comment: