Code Java, deploy JavaScript/HTML with the Google Web Toolkit
Mike’s reference to Google’s new Web Toolkit piqued my interest. It is quite novel in several ways
- It allow web client developers to code in Java rather than JavaScript. The code is translated prior to “deployment” by a Java-to-JavaScript compiler. The generated Javascript code uses a Javascript-based JRE emulation library that provides “most of java.lang and a subset of java.util”.
- The toolkit UI uses Eclipse SWT and (I’m pretty sure) the Java-to-JavaScript compiler is built on top of the JDT code model. Interesting use of JDT!
- The toolkit ships a command line utility that generates template Eclipse projects. Import the skeleton project into an Eclipse workspace and code away. I had to do a little hacking to use the generated launch configuration file to launch the toolkit from within Eclipse but it works. (Drop a copy of the .launch file into <workspace>\.metadata\.plugins\org.eclipse.debug.core\.launches, restart the workbench and then use Debug… and you’ll see it listed under “Java Applications”). This leads to one of the most powerful features. You can debug your application (as Java) when the toolkit is launched and/or you can write/run JUnit tests. Assuming the toolkit behaves itself when translating it all to Javascript you can be pretty confident the end user experience will be consistent.
- You can mix Javascript into your Java source if things get a little hairy.
- The toolkit uses Tomcat to host the “deployed” Javascript/HTML.
- The Javascript generated code (and library) provides lots of web client development conveniences like browser history management and major browser compatability.
- They’re giving it away for free but they only ship some of the source for the toolkit. It would of course be better if they shipped all of the source for the toolkit itself when integrating that much open source software (Eclipse/Tomcat/Mozilla/Rhino) into a free toolkit. Quid pro quo and all that.
See the overview for all the gory details.
All in all, it is not for the Javascript purists but it looks very handy for all those Eclipse/Java developers out there who occasionally need to knock up a web based application…
2 Comments to Code Java, deploy JavaScript/HTML with the Google Web Toolkit
Leave a comment
What I'm Doing...
- Weird, Jeff Stelling (brilliant Sky Sports 'Gillette Soccer Saturday' anchor) is to be the new Countdown host. He might be good... 3 hrs ago
- Merging Irish banks until only BOI & AIB exist is terrible idea. Their assets are too expensive to be 'saved' if required(>100% of I ... 8 hrs ago
- I've got a ticket for the Pumas game tomorrow...can't wait! 10 hrs ago
- @donncha OO now has a native OS X build of v3. Latest neooffice is still cut from OO v2 source still I think so it's probably a bit behind. 11 hrs ago
- @EvertB Wondering if anyone 'in the know' could comment on status of irish mobile operator network capacity? 18 hrs ago
- More updates...
Posting tweet...
Blogroll
LinkRoll
Category Cloud
amazon api app apple atom atompub australia banks beacon berlin blogging blosxom capeclear content copyright data dev drm dublin eclipse economy facebook firefox food football fowa future games google hardware identity internet ireland irish java junk linux mac media microsoft mobile movies music n800 net nooked oauth openid opensocial opml osgi oss patents politics polls process rails railsconf rest rss ruby search soa social software spam sport tech travel trip tv uk us vodafone wayoutthere web2.0 web services why xml yahoo youtube
Recent Posts
Recent Comments
- d harris on How many James Bond films are there?
- rud0y on How many James Bond films are there?
- Fergus Burns on Moving On
Archives
Photos
|


‘The generated Javascript code uses a Javascript-based JRE emulation library that provides “most of java.lang and a subset of java.util”.’
holy crap, that has got to craaaaaawl….
Yeah, I was going to post some examples of what the Java->Javascript compiler was producing…but…it was too big (and obfuscated) to make any sense on it’s own!
The more I think about it, the more limited the use cases for this toolkit, even for Eclipse/Java developers. A huge drawback is that the tolkit doesn’t help with calling existing REST/SOAP interfaces from the generated clients - it’s almost a walled garden (see http://web2.wsj2.com/googles_innovative_yet_limited_ajax_environment_gwt.htm)